Compute engine architecture to support data-parallel loops with reduction operations

ABSTRACT

Techniques involving a compute engine architecture to support data-parallel loops with reduction operations are described. In some embodiments, a hardware processor includes a memory unit and a plurality of processing elements (PEs). Each of the PEs is directly coupled via one or more neighbor-to-neighbor links with one or more neighboring PEs so that each PE can receive a value from a neighboring PE, provide a value to a neighboring PE, or both receive a value from one neighboring PE and also provide a value to another neighboring PE. The hardware processor also includes a control engine coupled with the plurality of PEs that is to cause the plurality of PEs to collectively perform a task to generate one or more output values by each performing one or more iterations of a same subtask of the task.

TECHNICAL FIELD

The disclosure relates generally to electronics, and, more specifically,embodiments relate to a compute engine architecture to supportdata-parallel loops with reduction operations.

BACKGROUND

In just the past few years, algorithms from the relatively nascent fieldof machine learning have been widely applied for many types of practicalapplications, resulting in technologies such as self-driving vehicles,improved Internet search engines, speech, audio, and/or visualrecognition systems, human health data and genome analysis,recommendation systems, fraud detection systems, etc. The growth ofthese algorithms has in part been fueled by recent increases in theamount and types of data being produced by both humans and non-humans.Thus, as the increased amount of data available for analysis hasskyrocketed, so too has the interest in machine learning.

However, machine learning algorithms tend to be computationallyexpensive, as they can involve performing huge numbers of non-trivialoperations (e.g., floating point multiplication) with huge amounts ofdata. As a result, it is extremely important to implement thesealgorithms as efficiently as possible, as any small inefficiency isquickly magnified due to the large scale of computation.

For example, many machine learning algorithms perform linear algebraoperations with huge matrices. However, these types of operations areextremely difficult to parallelize in modern computing systems, at leastin part due to potential write-to-read dependences across iterations(e.g., of a loop that updates values in a matrix, for example).

Some current approaches for performing these types of linear algebraoperations may employ locking techniques or approximate lock-freeimplementations. Locking continues to generate the same solution as asequential implementation, but trades-off this locking overhead forgreater parallelism. However, as a result of locking overhead, previousapproaches have shown that the performance does not scale beyond 2-4cores and does not result in anything near linear performance scalingeven until 4 cores.

The second approach—involving the use of approximate lock-freeimplementations—does get close to linear performance scaling, but doesnot achieve the best solution due to fundamentally relying uponapproximations. Furthermore, the output deviation can be particularlyhigh for datasets have a power-law distribution where some features aremore common than others, which leads to greater chances of incorrectupdates.

Accordingly, techniques enhancing the performance of these types ofalgorithms, such as those having write-to-read data dependencies acrossiterations of loops, are strongly desired.

BRIEF DESCRIPTION OF THE DRAWINGS

The invention may best be understood by referring to the followingdescription and accompanying drawings that are used to illustrate someembodiments. In the drawings:

FIG. 1 is a block diagram illustrating a system including a hardwareprocessor implementing a compute engine architecture to supportdata-parallel loops with reduction operations according to someembodiments.

FIG. 2 is a block diagram illustrating a cumulative distributionfunction (CDF) code snippet including a loop with inter-iteration datadependencies and an optimized CDF code snippet enabling substantialcompute speedup via the compute engine architecture of FIG. 1 accordingto some embodiments.

FIG. 3 is a block diagram illustrating exemplary data structures anddata that may be utilized by the optimized CDF code snippet of FIG. 2enabling substantial compute speedup via the disclosed compute enginearchitecture of FIG. 1 according to some embodiments.

FIG. 4 is a block diagram illustrating how a portion of the optimizedCDF code snippet of FIG. 2 may be executed by an exemplaryimplementation of the compute engine architecture of FIG. 1 according tosome embodiments.

FIG. 5 is a flow diagram illustrating a flow of operations for utilizinga compute engine architecture to support data-parallel loops accordingto some embodiments.

FIG. 6 is a flow diagram illustrating a flow of operations for executinga task utilizing a compute engine architecture including a plurality ofprocessing elements to support data-parallel loops according to someembodiments.

FIG. 7 illustrates an exemplary implementation in which an acceleratoris communicatively coupled to a plurality of cores through a cachecoherent interface according to some embodiments.

FIG. 8 illustrates another view of an accelerator according to someembodiments.

FIG. 9 illustrates an exemplary set of operations performed by theprocessing elements according to some embodiments.

FIG. 10a depicts an example of a multiplication between a sparse matrixA against a vector x to produce a vector y according to someembodiments.

FIG. 10b illustrates the CSR representation of matrix A in which eachvalue is stored as a (value, row index) pair according to someembodiments.

FIG. 10c illustrates a CSC representation of matrix A which uses a(value, column index) pair according to some embodiments.

FIGS. 11a, 11b, and 11c illustrate pseudo code of each compute pattern,in which:

FIG. 11a illustrates a row-oriented sparse matrix dense vector multiply(spMdV_csr) according to some embodiments.

FIG. 11b illustrates a column-oriented sparse matrix sparse vectormultiply (spMspC_csc) according to some embodiments.

FIG. 11c illustrates a scale and update operation (scale_update)according to some embodiments.

FIG. 12 illustrates the processing flow for one implementation of thedata management unit and the processing elements according to someembodiments.

FIG. 13a highlights paths for spMspV_csc and scale_update operationsaccording to some embodiments.

FIG. 13b illustrates paths for a spMdV_csr operation according to someembodiments.

FIGS. 14a-14b show an example of representing a graph as an adjacencymatrix.

FIG. 14c illustrates a vertex program according to some embodiments.

FIG. 14d illustrates exemplary program code for executing a vertexprogram according to some embodiments.

FIG. 14e shows a generalized sparse matrix vector multiply (GSPMV)formulation according to some embodiments.

FIG. 15 illustrates one implementation of a design framework for GSPMVaccording to some embodiments.

FIG. 16 shows one implementation of an architecture template for GSPMVaccording to some embodiments.

FIG. 17 illustrates a summarization of the operation of each acceleratortile according to some embodiments.

FIG. 18a illustrates a table summarizing the customizable parameters ofone implementation of the template according to some embodiments.

FIG. 18b illustrates tuning considerations of one implementation of theframework that performs automatic tuning to determine the best designparameters to use to customize the hardware architecture template inorder to optimize it for the input vertex program and (optionally) graphdata according to some embodiments.

FIG. 19 illustrates the compressed row storage (CRS, sometimesabbreviated CSR) sparse-matrix format according to some embodiments.

FIG. 20 shows exemplary steps involved in an implementation of sparsematrix-dense vector multiplication using the CRS data format accordingto some embodiments.

FIG. 21 illustrates one implementation of an accelerator includes anaccelerator logic die and one of more stacks of DRAM die according tosome embodiments.

FIG. 22 illustrates one implementation of the accelerator logic chip,oriented from a top perspective through the stack of DRAM die accordingto some embodiments.

FIG. 23 provides a high-level overview of a dot-product engine (DPE)which contains two buffers, two 64-bit multiply-add arithmetic logicunits (ALUs), and control logic according to some embodiments.

FIG. 24 illustrates a blocking scheme for large sparse-matrixcomputations according to some embodiments.

FIG. 25 illustrates a format of block descriptors according to someembodiments.

FIG. 26 illustrates the use of block descriptors for a two-row matrixthat fits within the buffers of a single dot-product engine, on a systemwith only one stacked dynamic random access memory (DRAM) data channeland four-word data bursts, according to some embodiments.

FIG. 27 illustrates one implementation of the hardware in a dot-productengine according to some embodiments.

FIG. 28 illustrates the contents of the match logic unit that doescapturing according to some embodiments.

FIG. 29 shows the details of a dot-product engine design to supportsparse matrix-sparse vector multiplication according to someembodiments.

FIG. 30 illustrates an example multi-pass approach using specific valuesaccording to some embodiments.

FIG. 31 shows how the sparse-dense and sparse-sparse dot-product enginesdescribed above can be combined according to some embodiments.

FIG. 32 is a block diagram of a register architecture 3200 according tosome embodiments.

FIG. 33A is a block diagram illustrating both an exemplary in-orderpipeline and an exemplary register renaming, out-of-orderissue/execution pipeline according to some embodiments.

FIG. 33B is a block diagram illustrating both an exemplary embodiment ofan in-order architecture core and an exemplary register renaming,out-of-order issue/execution architecture core to be included in aprocessor according to some embodiments.

FIGS. 34A-B illustrate a block diagram of a more specific exemplaryin-order core architecture, which core would be one of several logicblocks (including other cores of the same type and/or different types)in a chip:

FIG. 34A is a block diagram of a single processor core, along with itsconnection to the on-die interconnect network 3402 and with its localsubset of the Level 2 (L2) cache 3404, according to some embodiments.

FIG. 34B is an expanded view of part of the processor core in FIG. 34Aaccording to some embodiments.

FIG. 35 is a block diagram of a processor 3500 that may have more thanone core, may have an integrated memory controller, and may haveintegrated graphics according to some embodiments.

FIGS. 36-39 are block diagrams of exemplary computer architectures.

FIG. 36 shown a block diagram of a system in accordance with someembodiments.

FIG. 37 is a block diagram of a first more specific exemplary system inaccordance with some embodiments.

FIG. 38 is a block diagram of a second more specific exemplary system inaccordance with some embodiments.

FIG. 39 is a block diagram of a SoC in accordance with some embodiments.

FIG. 40 is a block diagram contrasting the use of a software instructionconverter to convert binary instructions in a source instruction set tobinary instructions in a target instruction set according to someembodiments.

DETAILED DESCRIPTION

The following description describes methods, apparatuses, and systemsinvolving a compute engine architecture to support data-parallel loopswith reduction operations. In this description, numerous specificdetails such as logic implementations, types and interrelationships ofsystem components, etc., may be set forth in order to provide a morethorough understanding of some embodiments. It will be appreciated,however, by one skilled in the art that the invention may be practicedwithout such specific details. In other instances, control structures,gate level circuits, and/or full software instruction sequences have notbeen shown in detail in order not to obscure the invention. Those ofordinary skill in the art, with the included descriptions, will be ableto implement appropriate functionality without undue experimentation.

References in the specification to “one embodiment,” “an embodiment,”“an example embodiment,” etc., indicate that the embodiment describedmay include a particular feature, structure, or characteristic, butevery embodiment may not necessarily include the particular feature,structure, or characteristic. Moreover, such phrases are not necessarilyreferring to the same embodiment. Further, when a particular feature,structure, or characteristic is described in connection with anembodiment, it is submitted that it is within the knowledge of oneskilled in the art to affect such feature, structure, or characteristicin connection with other embodiments whether or not explicitlydescribed.

Bracketed text and blocks with dashed borders (e.g., large dashes, smalldashes, dot-dash, and dots) may be used herein to illustrate optionaloperations that add additional features to embodiments of the invention.However, such notation should not be taken to mean that these are theonly options or optional operations, and/or that blocks with solidborders are not optional in certain embodiments of the invention.

Throughout this description, the use of a letter character at the end ofa reference numeral (corresponding to an illustrated entity) is notmeant to indicate or imply that any particular number of that entitymust necessarily exist, but merely that the entity is one of potentiallymany similar entities. For example, processing elements 106A-106Zinclude both “A” and “Z” letter suffixes, which means that there couldbe two processing elements, three processing elements, sixteenprocessing elements, etc.

Embodiments disclosed herein provide a compute engine architecture(e.g., extensions to a data parallel accelerator) to support dataparallel loops with inter-iteration data dependence or irregular controldependence. One common example of such data parallel loops exists whencalculating the cumulative distribution function (CDF) found in manytext analytics applications such as the Latent Dirichlet allocation(LDA). Existing data parallel accelerators do not support such loops,because they expect no dependence across iterations and supporting suchdependencies will incur large performance overheads.

However, embodiments disclosed herein provide a data parallelaccelerator with a daisy chain and reduction operation. With thedisclosed compute engine architecture, many common algorithms withinter-iteration loop dependencies (e.g., an implementation of CDF) canbe mapped to the data parallel accelerator and achieve extremely highperformance. Similarly, data parallel loops with irregular controldependence, such as the sorting of ‘n’ elements, can be performed at(for example) 1 cycle per element.

Also, existing hardware solutions for data parallel loops, such asvector units or Single Instruction Multiple Data (SIMD) units, rely oncompletely parallel loops to gain high efficiency and performance.However, again, these solutions suffer in terms of performance andefficiency as irregular data or control dependences are introducedacross iterations. Embodiments disclosed herein can support thesedependencies without any, or only minimal, software changes.

FIG. 1 is a block diagram illustrating a system 100 including a hardwareprocessor 102 implementing a compute engine architecture to supportdata-parallel loops with reduction operations according to someembodiments. The system includes the hardware processor 102, which insome embodiments is a hardware accelerator (e.g., a machine learningaccelerator) that can be utilized by another hardware processor 101(e.g., a central processing unit (CPU)) by “offloading” tasks to thehardware processor 102 (e.g., via an interface 130). Thus, the hardwareprocessor 102 may serve as a data parallel accelerator with explicitsupport for inter-iteration data dependence as well as irregular controldependence. However, in some embodiments, the hardware processor 102itself may be a CPU and thus, may not serve another processor.

The illustrated embodiment includes an array of processing elements106A-106Z that are connected via neighbor-to-neighbor links 120A-120Z aswell as a reduction link 126 (e.g., leading to a reduction network 124and/or control engine 104). With this architecture, embodiments canachieve high performance on loops that are difficult to handle for otherdata parallel structures, such as SIMD units. In various embodimentsthere may be different numbers of processing elements 106A-106Z, such astwo, four, six, eight, ten, twelve, sixteen, thirty-two, etc. Theparticular number of processing elements 106A-106Z can beflexibly-selected to optimize for a variety of factors, such as thetypes of operations the hardware processor 102 is expected to perform,the size and/or power availability of the hardware processor 102, etc.

In some embodiments, each of the processing elements 106A-106Z includeshardware blocks allowing the processing element to performing integer,floating-point, and/or control operations, including but not limited tomathematical operations (e.g., add, multiply), memory operations (e.g.,load, store), etc. Thus, in some embodiments each of the processingelements 106A-106Z may comprise circuitry to execute one or moreinstructions to perform operations, and may or may not be part of aprocessor core. Thus, a processing element may be thought of as one typeof a hardware processor. Each of the processing elements 106A-106Z canalso load or store data from/to a cache (e.g., memory unit 110) orfrom/to a “neighboring” processing element. For example, the firstprocessing element 106A can send a value (e.g., data) to its adjacentprocessing element 106B over a neighbor-to-neighbor link 120A.Similarly, the processing element 106B can receive this value over theneighbor-to-neighbor link 120A from the first processing element 106A aswell as sending another value (which could be the same or different asthe one received) to another neighboring/adjacent processing element106C (not illustrated herein) via another neighbor-to-neighbor link120B, and so on. The “last” processing element 106Z may similarlyreceive a value from its preceding neighbor processing element 106Y (notillustrated) over a neighbor-to-neighbor link 120Y, and optionally thisprocessing element 106Z may be connected via anotherneighbor-to-neighbor link 120Z (shown here with a dashed line tohighlight its optional nature) that can send a value “back” to the firstprocessing element 106A, though in other embodiments, this link 120Z maynot be included (or utilized), as data can be provided back to the firstprocessing element 106A in other ways (e.g., from the control engine 104via the work offload 122).

Optionally, the processing elements 106A-106Z may be connected to amemory unit 110, which may occur via a memory arbiter 108 unit. Thememory unit 110 and the memory arbiter 108 are blocks that are wellknown to those of ordinary skill in the art, and there are manytechniques and hardware elements that are well-known to those ofordinary skill in the art that could be used to implement theseelements. In some embodiments, the arbiter 108 may be part of a datamanagement unit (DMU) discussed later herein, which may or may not alsoinclude the (cache) memory unit 110. Additionally, in embodiments wherethe arbiter 108 is part of a DMU, the DMU may also include the reductionnetwork 124, and may also serve as the point of access (for theprocessing elements 106A-106Z) to an external memory unit 111.

In some embodiments using a memory unit 110, it can be an on-chip cachethat is “heavily” banked (e.g., 4 banks, 8 banks, 16 banks, 32 banks, 64banks) and optimized to provide relatively-low latency access (e.g., 5cycles, 10 cycles, 16 cycles) to the processing elements 106A-106Z. Forexample, the memory unit 110 could be 1 Megabyte (MB) in size with 32banks, 8 bytes per bank, 8 byte storage units, and have approximately 10cycles of latency. As another example, the memory unit 110 could be 512kilobytes (KB) in size with 32 banks, 8 bytes per bank, 8 byte storageunits, and have approximately 16 cycles of latency. Of course, manyother configurations can be utilized, though generally thoseconfigurations having larger numbers of banks (to allow larger numbersof parallel accesses) and having smaller latencies will generallyprovide enable the hardware processor 102 to have better performance forthe types of loops discussed herein having irregular data or controldependences being introduced across iterations. However, it is importantto note that in some embodiments this memory unit 110 is not included,as it is not strictly vital to the accelerator design but instead is adesign option that may or may not be useful in certain embodiments todue design considerations, the types of expected workloads and the typesof workloads to be optimized for, etc.

The hardware processor 102 is also shown as including a reduction link126 which the processing elements 106A-106Z can use to provide data to areduction network 124 and/or control engine 104. A reduction network 124can includes a variety of hardware blocks allowing it to perform“aggregate” type operations using data received from the processingelements 106A-106Z. For example, the reduction network 124 could beconfigured to add or multiply a plurality of received values, determinea statistical measure based upon the plurality of received values (e.g.,an average, mean, median, standard deviation), apply a particularfunction (e.g., a user defined function) to the values, cause the valuesto be stored in a memory unit 110/111, etc.

These values—either generated, modified, or supplemented with additionaldata by the reduction network 124, or provided directly by theprocessing elements 106A-106Z—may be provided to a control engine 104.The control engine 104 comprises hardware blocks that control or managethe functioning of the hardware processor 102 to perform the desiredtask. For example, in an embodiment where the hardware processor 102 isan accelerator, the control engine 104 may receive a signal/command toperform a task (e.g., from another hardware processor 101 via aninterface 130), may optionally load data from an external memory unit 11(to be provided to the processing elements 106A-106Z), “offload”subtasks of the task to the processing elements 106A-106Z (such as theinstructions for an iteration of a loop and/or data therefor), configurethe reduction network 124, etc.

To more clearly illustrate the benefits of this architecture, oneexample of a loop with inter-iteration data dependence is presented withreference to FIGS. 2, 3, and 4. However, it is to be understood thatthis example is just one (of limitless) types of loops withinter-iteration data dependence that can be executed in ahighly-performant manner by the embodiments disclosed herein; thus,embodiments are not to be limited to being applicable for only this oneexample.

Thus, we turn to FIG. 2, which is a block diagram illustrating acumulative distribution function (CDF) code snippet 200 including a loopwith inter-iteration data dependencies and an optimized CDF code snippet220 enabling substantial compute speedup via the compute enginearchitecture of FIG. 1 according to some embodiments.

The CDF kernel (“cdfOp”) code snippet 200 (having lines 201-210) iscommonly found in text analytics applications such as LDA, althoughsimilar loops are very common in other areas (e.g., computer vision) aswell. This cdfOp kernel is particularly difficult to parallelize onmodern processors due to inter-iteration data dependencies. For example,lines 205-209 show a loop having an inter-iteration datadependency—here, the variable “temp” (in line 207) is updated eachiteration by incrementing it, i.e., reading the current value, anddetermining and writing a new value to it that is based upon the currentvalue. Thus, in every iteration of this loop, the existing value of tempis required, so that it can be added to the result of“spVector[i].data*denseVector[spVector[i].index]”. Accordingly, existingprocessors struggle with parallelizing such loops efficiently due to thememory latency involved with continually updating this variable.Further, trying to get high vector utilization for this task is achallenge because of the gather/scatter operation as well as thedependence depth of 1-cycle. Thus, on an exemplary modern processorcore, this loop would require more than 2 cycles per element.

However, when mapped to our data parallel accelerator architecture (ascode segment 220—‘PECode_cdfOp’ at lines 221-232—to be executed by eachprocessing element), embodiments can sustain a throughput of 2 elementsper cycle, which is a vast improvement over 2 cycles per element.Furthermore, in some embodiments this code 220 for processing elementmapping can be easily auto-generated by existing compilers without anysoftware changes. Embodiments can achieve this performance using thereduce( ) fetchLeft( ) and/or sendRight( ) capabilities provided by thehardware processor 102.

In some embodiments, the reduce operation (at line 226) can be used by aprocessing element to utilize the reduction network 124 to, for example,perform a complex operation such as a summation, multiplication, etc.,which may or may not involve data values from vectors, matrices, orother data structures that may have been stored in compressed formats.Thus, a processing element can perform certain operations much morerapidly using this specialized hardware block, e.g., by sending arequest to perform an operation via reduction link 126 to reductionnetwork 124, which can return the result over the link 126 or backthrough control engine 104 to the processing element. However, in someembodiments and in some particular code executions, such reduceoperation may not need to be used—e.g., line 226 could be omitted, andthus instead the operations performed by the processing element itself.

In some embodiments, the processing elements 106A-106Z of the hardwareprocessor 102 can utilize a fetchLeft operation, which is shown in codesnippet 220 in line 227. A fetchLeft operation can cause the processingelement to acquire a value being passed on the neighbor-to-neighbor link120 connecting the processing element to its “preceding” processingelement. Similarly, in some embodiments the processing elements106A-106Z of the hardware processor 102 can utilize a sendRightoperation, which is shown in code snippet 220 at line 229. A sendRightoperation can cause the processing element to send a value via aneighbor-to-neighbor link 120 connecting the processing element to its“next” processing element.

Thus, in the optimized code snippet 220, an embodiment can use a reduceoperation at line 226 to efficiently determine a result of themultiplication of line 225, acquire the “existing” (or “previous”) valueof temp (from line 207 of the previous code segment 200) as prevValthrough the use of the fetchLeft operation, determine a newVal basedupon the result of the reduce operation and the fetchLeft operation (atline 228), and both send the newVal to a neighboring processing element(via sendRight operation at line 229) for its use to execute the nextiteration of the same loop, and update the output vector (outputVector)with the new value.

Thus, in some embodiments, the processing elements 106A-106Z can performsuccessive, iterations of a same loop in a near simultaneous mannerwhile eliminating substantial time penalties incurred due tointer-iteration data dependencies, as the processing elements 106A-106Zcan quickly acquire a result from a previous iteration as soon as it isavailable (from a neighboring processing element performing thepreceding iteration) and/or can quickly provide the result of itsiteration as soon as it is available (to a neighboring processingelement that is performing the successive iteration of the loop).

For ease of understanding and to provide clarity into the efficiency ofhardware processor 102, an exemplary sample execution of code snippet220 will be illustrated. To begin this example, we turn to FIG. 3, whichis a block diagram illustrating exemplary data structures and data thatmay be utilized by the optimized CDF code snippet of FIG. 2 enablingsubstantial speedup via the disclosed compute engine architecture ofFIG. 1 according to some embodiments.

FIG. 3 illustrates an exemplary sparse vector 305 and an exemplary densevector 320 corresponding to the “spVector” and “denseVector” variablespredominantly referenced in code snippet 220 at lien 225. The exemplarysparse vector 305 is “sparse” in that includes a substantial number of“empty” values (here, “0” values). In many modern machine learningenvironments, such sparse vectors are very common, and instead ofwasting substantial amounts of memory to store a complete sparse vector305, the spare vector 305 may instead be stored as a compressed sparsevector 310 representation. The compressed sparse vector 310 shownincludes an element 312 (here, a pair including a value 314 and an index316) for each of the non-empty (or, non-zero) values of the sparsevector 305. Thus, each element 312 includes one of the values 314 fromthe sparse vector 305 as well as the index 316 number indicating thelocation of that value 314 within the original sparse vector 305. Asillustrated, the first element 312 is (2, 0), indicating that the number2 is located at the 0^(th) index (or, is the first element) of exemplarysparse vector 305; likewise, the fourth element (6, 5) indicates thatthe number 6 is located at the 5^(th) index (or, is the sixth element)of exemplary sparse vector 305. Thus, because there are five non-zerovalues of the exemplary sparse vector 305, the compressed sparse vector310 includes five elements 312. Accordingly, the variable “vectorLen”318 is set to five, which is used in code snippet 220 at line 223.

The exemplary dense vector 320 is not a sparse vector, as it does notinclude a substantial number of empty values. Of course, the term“substantial” is a relative term and thus the exact definition canflexibly be determined based upon the particular implementation, inwhich the costs versus benefits of using compressed data structures asopposed to regular uncompressed data structures can be weighed.Accordingly, because the vector is dense, in some embodiments the vectorcan be used as a typical array/list of values, such as exemplary sparsevector representation 325.

Thus, to continue our example, the compressed sparse vector 310 will beused as “spVector” and the exemplary dense vector representation will beused as “denseVector” within the portion 400 of the code block 220,which is illustrated in FIG. 4. FIG. 4 is a block diagram illustratinghow a portion 400 of the optimized CDF code snippet 220 of FIG. 2 may beexecuted by an exemplary implementation of the compute enginearchitecture of FIG. 1 according to some embodiments.

Accordingly, in this example, the code portion 400 (which can bereferred to as a subtask of an entire task, i.e., the entire codesnippet 220, or another program including or calling for the performanceof the code snippet 220) will be executed by each of three processingelements 106A-106C. Of course, in various embodiments the number ofprocessing elements 106A-106Z can vary greatly, and more processingelements may be used to enable further speedup; in this exemplaryexecution 405, only three processing elements 106A-106C are used toallow for clarity and ease of understanding.

In this exemplary execution 405, the three processing elements 106A-106Cmay execute a first round 440 where each processing element will executethe code portion 400. In particular, the first processing element 106Awill execute a first iteration 412 of the loop, the second processingelement 106B will execute a second iteration 422 of the loop, and thethird processing element 106C will execute a third iteration 432 of theloop. This can be implemented, for example, by having each of theprocessing elements begin the loop in line 222 with a different startingvalue—here, 0 for the first processing element 160A, 1 for the secondprocessing element 160B, and 2 for the third processing element 160C.

In this first round 440, the first processing element 106A willdetermine the currVal as 4 (at lines 224-225), determine the previousvalue (via fetchLeft, which here can be null or “0”, as there is nopreceding iteration) is NULL at line 226, and determine the newVal to beequal to 4+NULL, or 4, at line 227. This value, at line 228, can beemitted (or sent) from the first processing element 106A via aneighbor-to-neighbor link 120A to the second processing element 106Balmost immediately, allowing the second processing element 106B to usethis value in line 226 to compute its own newVal (of “6”), whichsimilarly can be passed on to the third processing element 106C (via thesecond processing element 106B performing a sendRight operation at line228) for its use. Thus, within an extremely short amount of time, thefirst three data-dependent iterations of the loop can be performed. Thisstands in stark contrast to other modern processing elements, which canhave substantial delays needed between iterations, as the memory accessdelays cannot be “hidden” through well-known compiler optimizations,etc.

In this example, the value laneLength can be provided to the processingelements 106A-106C to indicate the number of processing elements106A-106C that are performing iterations, and thus, in this case thevalue of laneLength can be 3.

Thus, as the increment size of the “i” loop counter is the size oflaneLength (see line 222, where “i+=laneLength”), the value of i is now3 for the first processing element 160A and 4 for the second processingelement 160B. Because i would be 5 for the third processing element160C, and because 5 exceeds the loop condition (of i<vectorLen, or i<5),the third processing element 106C will not perform a second iterationduring the second round 450.

However, the first processing element 106A and the second processingelement 106B will perform iterations 414 and 424, respectively, tocomplete the execution of the sub-task. As shown with a dotted line, thevalue of line 228 from the third processing element 106C (from iteration432) can be directly provided (e.g., via a sendRight operation) in caseswhere a neighbor-to-neighbor link exists between the third processingelement 106C and the first processing element 106A, enabling a circularsendRight. However, in other embodiments, the value from sendRight caninstead be passed by the third processing element 106C to the controlengine 104 (when the third processing element 106C may not have aneighbor-to-neighbor link with the first processing element 106A), whichcan thus provide the value to the first processing element 106A.

Notably, this example is presented using certain abstractions so as tonot obscure aspects of an embodiment of the invention. Thus, forexample, these precise illustrated instructions 220 may not be executedby the processing elements, but instead different instructions(generated either dynamically or statically based upon the illustratedcode 220) may be executed in various embodiments.

We now turn to FIG. 5, which is a flow diagram illustrating a flow 500of operations for utilizing a compute engine architecture to supportdata-parallel loops according to some embodiments. The operations inthis and other flow diagrams will be described with reference to theexemplary embodiments of the other figures. However, it should beunderstood that the operations of the flow diagrams can be performed byembodiments other than those discussed with reference to the otherfigures, and the embodiments discussed with reference to these otherfigures can perform operations different than those discussed withreference to the flow diagrams. In some embodiments, this flow 500 isperformed by a hardware processor 102 of FIG. 1.

Optionally, the flow 500 includes block 505 and determining, by a firsthardware processor, that a task as been offloaded from a second hardwareprocessor to the first hardware processor to perform. The first hardwareprocessor comprises a memory unit that is banked into a plurality ofbanks and a plurality of processing elements. Each of the plurality ofprocessing elements is directly coupled via one or moreneighbor-to-neighbor links with one or more neighboring processingelements so that the processing element can (1) receive a value from aneighboring processing element, (2) provide a value to a neighboringprocessing element, or (3) receive a value from one neighboringprocessing element and provide a value to another neighboring processingelement.

At block 510, the flow 500 includes executing the task by the firsthardware processor, wherein executing the task includes causing each ofthe plurality of processing elements to execute one or more iterationsof a same subtask of the task. For each of the iterations, ones (e.g.,at least half) of the plurality of processing elements are to access oneor more data values obtained from the memory unit and both (1) determinea value based upon a first value received from a first neighboringprocessing element and at least one of the one or more data values and(2) provide the determined value to a second neighboring processingelement for its use in performing the iteration of the subtask. Theexecuting of the task results in the second hardware processordetermining one or more output values.

Optionally, at block 515, the flow 500 optionally includes providing, bythe first hardware processor, the one or more output values to thesecond hardware processor.

One example of block 510 is presented within FIG. 6, which is a flowdiagram illustrating a flow 600 of operations for executing a taskutilizing a compute engine architecture including a plurality ofprocessing elements to support data-parallel loops according to someembodiments. However, some embodiments can perform flow 600 and itsoperations may not serve as part of flow 500—i.e., some embodiments maynot perform flow 500, but still may perform flow 600. In someembodiments, this flow 600 is performed by a hardware processor 102 ofFIG. 1.

Flow 600 includes, at block 605, executing, by a first processingelement of a plurality of processing elements (PEs) of a hardwareprocessor, a first iteration of a subtask of a task. The executingincludes accessing a first set of one or more data values from a memoryunit, generating a first value based upon the first set of data values,and sending the first value to a second PE of the plurality of PEs via afirst neighbor-to-neighbor link.

Flow 600 also includes, at block 610, executing, by the second PE of theplurality of PEs, a second iteration of the subtask, comprisingaccessing a second set of one or more data values from the memory unit,generating a second value based upon the second set of data values andalso the first value, and sending the second value to a third PE of theplurality of PEs via a second neighbor-to-neighbor link.

Optionally, the flow 600 also includes one or more iterations (shown viadashed line 655) of block 615, which includes executing, by an x-th(e.g., third, fourth, fifth) PE of the plurality of PEs, an x-thiteration of the subtask, comprising accessing an x-th set of one ormore data values from the memory unit, generating an x-th value basedupon the x-th set of data values and also the (x−1)th value. Optionally,block 615 includes sending the x-th value to a y-th PE of the pluralityof PEs via an x-th neighbor-to-neighbor link. In embodiments where block615 is performed one or more times (e.g., by different PEs), the flowmay continue back to block 605 via arrow 650 for the execution of asecond round of iterations by the PEs. Additionally or alternatively, insome embodiments, the flow 600 may continue via arrow 660 (or from block610) to block 620.

Block 620 includes determining, by the HP, one or more output values tobe a result of the task based at least in part upon the first value andthe second value. In some embodiments, such as those where flow 600includes one or more iterations of block 615, block 620 may furtherinclude that the one or more output values are further determined basedupon the generated Xth values from block 615.

EXAMPLES

In some embodiments, a method in a first hardware processor (HP)comprises: determining, by the first HP, that a task as been offloadedfrom a second HP to the first HP, the first HP comprising a memory unitthat is banked into a plurality of banks and a plurality of processingelements (PEs), each PE being directly coupled via one or moreneighbor-to-neighbor links with one or more neighboring PEs so that eachPE can receive a value from a neighboring PE, provide a value to aneighboring PE, or both receive a value from one neighboring PE and alsoprovide a value to another neighboring PE; executing the task by thefirst HP, including causing each of the plurality of PEs to execute oneor more iterations of a same subtask of the task, wherein for each ofthe iterations ones of the plurality of PEs are to access one or moredata values obtained from the memory unit and both determine a valuebased upon a first value received from a first neighboring PE and atleast one of the one or more data values and provide the determinedvalue to a second neighboring PE for its use in performing the iterationof the subtask, wherein the executing of the task results in the firstHP determining one or more output values; and providing, by the firstHP, the one or more output values to the second HP. In some embodiments,the plurality of banks includes at least eight banks. In someembodiments, the plurality of banks includes at least thirty-two banks.In some embodiments, there are at most twenty cycles of latency for amemory access by one of the plurality of PEs to one of the plurality ofbanks of the memory unit. In some embodiments, the one or more datavalues comprise a first vector of data values and a second vector ofdata values, wherein the determined value is based upon at least onedata value of the first vector of data values and at least one value ofthe second vector of data values. In some embodiments, each of theplurality of PEs is capable of performing integer operations, floatingpoint operations, and control operations. In some embodiments, executingthe task by the first HP comprises executing one or more instructionsgenerated by a compiler, wherein the one or more instructions include atleast one fetchLeft instruction causing a PE to obtain a value from aneighboring PE via a neighbor-to-neighbor link and at least onesendRight instruction causing a PE to send a value to a neighboring PEvia a neighbor-to-neighbor link.

In some embodiments, executing the task comprises: executing, by a firstprocessing element (PE) of a plurality of PEs of the HP, a firstiteration of the subtask, wherein the executing includes accessing afirst set of one or more data values from the memory unit, generating afirst value based upon the first set of data values, and sending thefirst value to a second PE of the plurality of PEs via a firstneighbor-to-neighbor link; executing, by the second PE of the pluralityof PEs, a second iteration of the subtask, comprising accessing a secondset of one or more data values from the memory unit, generating a secondvalue based upon the second set of data values and also the first value,and sending the second value to a third PE of the plurality of PEs via asecond neighbor-to-neighbor link; and determining, by the HP, one ormore output values to be a result for the task based at least in partupon the first value and the second value

According to some embodiments, a hardware processor comprises: a memoryunit that is banked into a plurality of banks; a plurality of processingelements (PEs), wherein each of the plurality of PEs is directly coupledvia one or more neighbor-to-neighbor links with one or more neighboringPEs of the plurality of PEs so that each PE can receive a value from aneighboring PE, provide a value to a neighboring PE, or both receive avalue from one neighboring PE and also provide a value to anotherneighboring PE; and a control engine that is coupled with the pluralityof PEs that is to cause the plurality of PEs to collectively perform atask to generate one or more output values by each performing one ormore iterations of a same subtask of the task, wherein each of the oneor more iterations includes the PE receiving a value from a neighboringPE, providing a value to a neighboring PE, or both receiving a valuefrom one neighboring PE and also providing a value to anotherneighboring PE. In some embodiments, the plurality of banks includes atleast eight banks. In some embodiments, the plurality of banks includesat least thirty-two banks. In some embodiments, there are at most twentycycles of latency for a memory access by one of the plurality of PEs toone of the plurality of banks of the memory unit. In some embodiments,each of the plurality of PEs is capable of performing integeroperations, floating point operations, and control operations. In someembodiments, the hardware processor further includes an interface thatis to enable the hardware processor to be coupled via one or more buseswith another hardware processor, wherein the another hardware processoris to offload the task to the hardware processor.

According to some embodiments, a system comprises: a first hardwareprocessor that is to offload a task to a second hardware processor; andthe second hardware processor. The second hardware processor comprises:a memory unit that is banked into a plurality of banks; a plurality ofprocessing elements (PEs), wherein each of the plurality of PEs isdirectly coupled via one or more neighbor-to-neighbor links with one ormore neighboring PEs of the plurality of PEs so that each PE can receivea value from a neighboring PE, provide a value to a neighboring PE, orboth receive a value from one neighboring PE and also provide a value toanother neighboring PE; and a control engine that is coupled with theplurality of PEs and that is to cause the plurality of PEs tocollectively perform a task to generate one or more output values byeach performing one or more iterations of a same subtask of the task,wherein each of the one or more iterations includes the PE receiving avalue from a neighboring PE, providing a value to a neighboring PE, orboth receiving a value from one neighboring PE and also providing avalue to another neighboring PE. In some embodiments, the plurality ofbanks includes at least eight banks. In some embodiments, the pluralityof banks includes at least thirty-two banks. In some embodiments, thereare at most twenty cycles of latency for a memory access by one of theplurality of PEs to one of the plurality of banks of the memory unit. Insome embodiments, each of the plurality of PEs is capable of performinginteger operations, floating point operations, and control operations.In some embodiments, the second hardware processor further includes aninterface that couples the second hardware processor via one or morebuses with the first hardware processor, wherein the another hardwareprocessor is to offload the task to the hardware processor.

According to some embodiments, a method in a hardware processor (HP)comprises executing, by a first processing element (PE) of a pluralityof PEs of the HP, a first iteration of a subtask of a task, wherein theexecuting includes accessing a first set of one or more data values froma memory unit, generating a first value based upon the first set of datavalues, and sending the first value to a second PE of the plurality ofPEs via a first neighbor-to-neighbor link; executing, by the second PEof the plurality of PEs, a second iteration of the subtask, comprisingaccessing a second set of one or more data values from the memory unit,generating a second value based upon the second set of data values andalso the first value, and sending the second value to a third PE of theplurality of PEs via a second neighbor-to-neighbor link; anddetermining, by the HP, one or more output values to be a result for thetask based at least in part upon the first value and the second value.

According to some embodiments, a hardware processor (HP) comprises:means for executing, by a first processing element (PE) of a pluralityof PEs of the HP, a first iteration of a subtask of a task, wherein theexecuting includes accessing a first set of one or more data values froma memory unit, generating a first value based upon the first set of datavalues, and sending the first value to a second PE of the plurality ofPEs via a first neighbor-to-neighbor link; means for executing, by thesecond PE of the plurality of PEs, a second iteration of the subtask,comprising accessing a second set of one or more data values from thememory unit, generating a second value based upon the second set of datavalues and also the first value, and sending the second value to a thirdPE of the plurality of PEs via a second neighbor-to-neighbor link; andmeans for determining, by the HP, one or more output values to be aresult for the task based at least in part upon the first value and thesecond value.

Embodiments disclosed herein utilize electronic devices. An electronicdevice stores and transmits (internally and/or with other electronicdevices over a network) code (which is composed of software instructionsand which is sometimes referred to as computer program code or acomputer program) and/or data using machine-readable media (also calledcomputer-readable media), such as machine-readable storage media (e.g.,magnetic disks, optical disks, read only memory (ROM), flash memorydevices, phase change memory) and machine-readable transmission media(also called a carrier) (e.g., electrical, optical, radio, acoustical orother form of propagated signals—such as carrier waves, infraredsignals). Thus, an electronic device (e.g., a computer) includeshardware and software, such as a set of one or more processors coupledto one or more machine-readable storage media to store code forexecution on the set of processors and/or to store data. For instance,an electronic device may include non-volatile memory containing the codesince the non-volatile memory can persist code/data even when theelectronic device is turned off (when power is removed), and while theelectronic device is turned on that part of the code that is to beexecuted by the processor(s) of that electronic device is typicallycopied from the slower non-volatile memory into volatile memory (e.g.,dynamic random access memory (DRAM), static random access memory (SRAM))of that electronic device. Typical electronic devices also include a setor one or more physical network interface(s) to establish networkconnections (to transmit and/or receive code and/or data usingpropagating signals) with other electronic devices. One or more parts ofan embodiment may be implemented using different combinations ofsoftware, firmware, and/or hardware.

Exemplary Accelerator Architectures

Overview

In some implementations, an accelerator is coupled to processor cores orother processing elements to accelerate certain types of operations suchas graphics operations, machine-learning operations, pattern analysisoperations, and (as described in detail below) sparse matrixmultiplication operations, to name a few. The accelerator may becommunicatively coupled to the processor/cores over a bus or otherinterconnect (e.g., a point-to-point interconnect) or may be integratedon the same chip as the processor and communicatively coupled to thecores over an internal processor bus/interconnect. Regardless of themanner in which the accelerator is connected, the processor cores mayallocate certain processing tasks to the accelerator (e.g., in the formof sequences of instructions or μops) which includes dedicatedcircuitry/logic for efficiently processing these tasks.

FIG. 7 illustrates an exemplary implementation in which an accelerator700 is communicatively coupled to a plurality of cores 710-711 through acache coherent interface 730. Each of the cores 710-711 includes atranslation lookaside buffer 712-713 for storing virtual to physicaladdress translations and one or more caches 714-715 (e.g., L1 cache, L2cache, etc.) for caching data and instructions. A memory management unit720 manages access by the cores 710-711 to system memory 750 which maybe a dynamic random access memory DRAM. A shared cache 726 such as an L3cache may be shared among the processor cores 710-711 and with theaccelerator 700 via the cache coherent interface 730. In oneimplementation, the cores ATA1010T-1011, MMU 720 and cache coherentinterface 730 are integrated on a single processor chip.

The illustrated accelerator 700 includes a data management unit 705 witha cache 707 and scheduler AT006 for scheduling operations to a pluralityof processing elements 701-702, N. In the illustrated implementation,each processing element has its own local memory 703-704, N. Asdescribed in detail below, each local memory 703-704, N may beimplemented as a stacked DRAM.

In one implementation, the cache coherent interface 730 providescache-coherent connectivity between the cores 710-711 and theaccelerator 700, in effect treating the accelerator as a peer of thecores 710-711. For example, the cache coherent interface 730 mayimplement a cache coherency protocol to ensure that dataaccessed/modified by the accelerator 700 and stored in the acceleratorcache 707 and/or local memories 703-704, N is coherent with the datastored in the core caches 710-711, the shared cache 726 and the systemmemory 750. For example, the cache coherent interface 730 mayparticipate in the snooping mechanisms used by the cores 710-711 and MMU720 to detect the state of cache lines within the shared cache 726 andlocal caches 714-715 and may act as a proxy, providing snoop updates inresponse to accesses and attempted modifications to cache lines by theprocessing elements 701-702, N. In addition, when a cache line ismodified by the processing elements 701-702, N, the cache coherentinterface 730 may update the status of the cache lines if they arestored within the shared cache 726 or local caches 714-715.

In one implementation, the data management unit 1005 includes memorymanagement circuitry providing the accelerator 700 access to systemmemory 750 and the shared cache 726. In addition, the data managementunit 705 may provide updates to the cache coherent interface 730 andreceiving updates from the cache coherent interface 730 as needed (e.g.,to determine state changes to cache lines). In the illustratedimplementation, the data management unit 705 includes a scheduler 706for scheduling instructions/operations to be executed by the processingelements 701-702, N. To perform its scheduling operations, the scheduler706 may evaluate dependences between instructions/operations to ensurethat instructions/operations are executed in a coherent order (e.g., toensure that a first instruction executes before a second instructionwhich is dependent on results from the first instruction).Instructions/operations which are not inter-dependent may be executed inparallel on the processing elements 701-702, N.

Accelerator Architecture for Matrix and Vector Operations

FIG. 8 illustrates another view of accelerator 700 and other componentspreviously described including a data management unit 705, a pluralityof processing elements 701-N, and fast on-chip storage 800 (e.g.,implemented using stacked local DRAM in one implementation). In oneimplementation, the accelerator 700 is a hardware acceleratorarchitecture and the processing elements 701-N include circuitry forperforming matrix*vector and vector*vector operations, includingoperations for sparse/dense matrices. In particular, the processingelements 701-N may include hardware support for column and row-orientedmatrix processing and may include microarchitectural support for a“scale and update” operation such as that used in machine learning (ML)algorithms.

The described implementations perform matrix/vector operations which areoptimized by keeping frequently used, randomly accessed, potentiallysparse (e.g., gather/scatter) vector data in the fast on-chip storage800 and maintaining large, infrequently used matrix data in off-chipmemory (e.g., system memory 750), accessed in a streaming fashionwhenever possible, and exposing intra/inter matrix block parallelism toscale up.

Implementations of the processing elements 701-N process differentcombinations of sparse matrixes, dense matrices, sparse vectors, anddense vectors. As used herein, a “sparse” matrix or vector is a matrixor vector in which most of the elements are zero. By contrast, a “dense”matrix or vector is a matrix or vector in which most of the elements arenon-zero. The “sparsity” of a matrix/vector may be defined based on thenumber of zero-valued elements divided by the total number of elements(e.g., m×n for an m×n matrix). In one implementation, a matrix/vector isconsidered “sparse” if its sparsity if above a specified threshold.

An exemplary set of operations performed by the processing elements701-N is illustrated in the table in FIG. 9. In particular the operationtypes include a first multiply 900 using a sparse matrix, a secondmultiply 901 using a dense matrix, a scale and update operation 902 mand a dot product operation 903. Columns are provided for a first inputoperand 910 and a second input operand 911 (each of which may includesparse or dense matrix/vector); an output format 913 (e.g., dense vectoror scalar); a matrix data format (e.g., compressed sparse row,compressed sparse column, row-oriented, etc.); and an operationidentifier 914.

The runtime-dominating compute patterns found in some current workloadsinclude variations of matrix multiplication against a vector inrow-oriented and column-oriented fashion. They work on well-known matrixformats: compressed sparse row (CSR) and compressed sparse column (CSC).FIG. 10a depicts an example of a multiplication between a sparse matrixA against a vector x to produce a vector y. FIG. 10b illustrates the CSRrepresentation of matrix A in which each value is stored as a (value,row index) pair. For example, the (3,2) for row0 indicates that a valueof 3 is stored in element position 2 for row 0. FIG. 10c illustrates aCSC representation of matrix A which uses a (value, column index) pair.

FIGS. 11a, 11b, and 11c illustrate pseudo code of each compute pattern,which is described below in detail. In particular, FIG. 11a illustratesa row-oriented sparse matrix dense vector multiply (spMdV_csr); FIG. 11billustrates a column-oriented sparse matrix sparse vector multiply(spMspC_csc); and FIG. 11c illustrates a scale and update operation(scale_update).

A. Row-Oriented Sparse Matrix Dense Vector Multiplication (spMdV_csr)

This is a well-known compute pattern that is important in manyapplication domains such as high-performance computing. Here, for eachrow of matrix A, a dot product of that row against vector x isperformed, and the result is stored in the y vector element pointed toby the row index. This computation is used in a machine-learning (ML)algorithm that performs analysis across a set of samples (i.e., rows ofthe matrix). It may be used in techniques such as “mini-batch.” Thereare also cases where ML algorithms perform only a dot product of asparse vector against a dense vector (i.e., an iteration of thespMdV_csr loop), such as in the stochastic variants of learningalgorithms.

A known factor that can affect performance on this computation is theneed to randomly access sparse x vector elements in the dot productcomputation. For a conventional server system, when the x vector islarge, this would result in irregular accesses (gather) to memory orlast level cache.

To address this, one implementation of a processing element dividesmatrix A into column blocks and the x vector into multiple subsets (eachcorresponding to an A matrix column block). The block size can be chosenso that the x vector subset can fit on chip. Hence, random accesses toit can be localized on-chip.

B. Column-Oriented Sparse Matrix Sparse Vector Multiplication(spMspV_csc)

This pattern that multiplies a sparse matrix against a sparse vector isnot as well-known as spMdV_csr. However, it is important in some MLalgorithms. It is used when an algorithm works on a set of features,which are represented as matrix columns in the dataset (hence, the needfor column-oriented matrix accesses).

In this compute pattern, each column of the matrix A is read andmultiplied against the corresponding non-zero element of vector x. Theresult is used to update partial dot products that are kept at the yvector. After all the columns associated with non-zero x vector elementshave been processed, the y vector will contain the final dot products.

While accesses to matrix A is regular (i.e., stream in columns of A),the accesses to the y vector to update the partial dot products isirregular. The y element to access depends on the row index of the Avector element being processed. To address this, the matrix A can bedivided into row blocks. Consequently, the vector y can be divided intosubsets corresponding to these blocks. This way, when processing amatrix row block, it only needs to irregularly access (gather/scatter)its y vector subset. By choosing the block size properly, the y vectorsubset can be kept on-chip.

C. Scale and Update (Scale_Update)

This pattern is typically used by ML algorithms to apply scaling factorsto each sample in the matrix and reduced them into a set of weights,each corresponding to a feature (i.e., a column in A). Here, the xvector contains the scaling factors. For each row of matrix A (in CSRformat), the scaling factors for that row are read from the x vector,and then applied to each element of A in that row. The result is used toupdate the element of y vector. After all rows have been processed, they vector contains the reduced weights.

Similar to prior compute patterns, the irregular accesses to the yvector could affect performance when y is large. Dividing matrix A intocolumn blocks and y vector into multiple subsets corresponding to theseblocks can help localize the irregular accesses within each y sub set.

One implementation includes a hardware accelerator 1000 that canefficiently perform the compute patterns discussed above. Theaccelerator 1000 is a hardware IP block that can be integrated withgeneral purpose processors, similar to those found in existingaccelerator-based solutions (e.g., IBM® PowerEN, Oracle® M7). In oneimplementation, the accelerator 700 independently accesses memory 750through an interconnect shared with the processors to perform thecompute patterns. It supports any arbitrarily large matrix datasets thatreside in off-chip memory.

FIG. 12 illustrates the processing flow for one implementation of thedata management unit 705 and the processing elements 701-702. In thisimplementation, the data management unit 705 includes a processingelement scheduler 1201, a read buffer 1202, a write buffer 1203 and areduction unit 1204. Each PE 701-702 includes an input buffer 1205-1206,a multiplier 1207-1208, an adder 1209-1210, a local RAM 1221-1222, a sumregister 1211-1212, and an output buffer 1213-1214.

The accelerator supports the matrix blocking schemes discussed above(i.e., row and column blocking) to support any arbitrarily large matrixdata. The accelerator is designed to process a block of matrix data.Each block is further divided into sub-blocks which are processed inparallel by the Pes 701-702.

In operation, the data management unit 705 reads the matrix rows orcolumns from the memory subsystem into its read buffer 1202, which isthen dynamically distributed by the PE scheduler 1201 across PEs 701-702for processing. It also writes results to memory from its write buffer1203.

Each PE 701-702 is responsible for processing a matrix sub-block. A PEcontains an on-chip RAM 1221-1222 to store the vector that needs to beaccessed randomly (i.e., a subset of x or y vector, as described above).It also contains a floating point multiply-accumulate (FMA) unitincluding multiplier 1207-1208 and adder 1209-1210 and unpack logicwithin input buffers 1205-1206 to extract matrix elements from inputdata, and a sum register 1211-1212 to keep the accumulated FMA results.

One implementation of the accelerator achieves extreme efficienciesbecause (1) it places irregularly accessed (gather/scatter) data inon-chip PE RAMs 1221-1222, (2) it utilizes a hardware PE scheduler 1201to ensure PEs are well utilized, and (3) unlike with general purposeprocessors, the accelerator consists of only the hardware resources thatare essential for sparse matrix operations. Overall, the acceleratorefficiently converts the available memory bandwidth provided to it intoperformance.

Scaling of performance can be done by employing more PEs in anaccelerator block to process multiple matrix subblocks in parallel,and/or employing more accelerator blocks (each has a set of PEs) toprocess multiple matrix blocks in parallel. A combination of theseoptions is considered below. The number of PEs and/or accelerator blocksshould be tuned to match the memory bandwidth.

One implementation of the accelerator 700 can be programmed through asoftware library (similar to Intel® Math Kernel Library). Such libraryprepares the matrix data in memory, sets control registers in theaccelerator 700 with information about the computation (e.g.,computation type, memory pointer to matrix data), and starts theaccelerator. Then, the accelerator independently accesses matrix data inmemory, performs the computation, and writes the results back to memoryfor the software to consume.

The accelerator handles the different compute patterns by setting itsPEs to the proper datapath configuration, as depicted in FIGS. 13a-13b .In particular, FIG. 13a highlights paths (using dotted lines) forspMspV_csc and scale_update operations and FIG. 13b illustrates pathsfor a spMdV_csr operation. The accelerator operation to perform eachcompute pattern is detailed below.

For spMspV_csc, the initial y vector subset is loaded in to PE's RAM1221 by the DMU 705. It then reads x vector elements from memory. Foreach x element, the DMU 705 streams the elements of the correspondingmatrix column from memory and supplies them to the PE 701. Each matrixelement contains a value (A.val) and an index (A.idx) which points tothey element to read from PE's RAM 1221. The DMU 1005 also provides thex vector element (x.val) that is multiplied against A.val by themultiply-accumulate (FMA) unit. The result is used to update the yelement in the PE's RAM pointed to by A.idx. Note that even though notused by our workloads, the accelerator also supports column-wisemultiplication against a dense x vector (spMdV_csc) by processing allmatrix columns instead of only a subset (since x is dense).

The scale_update operation is similar to the spMspV_csc, except that theDMU 705 reads the rows of an A matrix represented in a CSR formatinstead of a CSC format. For the spMdV_csr, the x vector subset isloaded in to the PE's RAM 1221. DMU 705 streams in matrix row elements(i.e., {A.val,A.idx} pairs) from memory. A.idx is used to read theappropriate x vector element from RAM 1221, which is multiplied againstA.val by the FMA. Results are accumulated into the sum register 1212.The sum register is written to the output buffer each time a PE sees amarker indicating an end of a row, which is supplied by the DMU 705. Inthis way, each PE produces a sum for the row sub-block it is responsiblefor. To produce the final sum for the row, the sub-block sums producedby all the PEs are added together by the Reduction Unit 1204 in the DMU(see FIG. 12). The final sums are written to the output buffer1213-1214, which the DMU 1005 then writes to memory.

Graph Data Processing

In one implementation, the accelerator architectures described hereinare configured to process graph data. Graph analytics relies on graphalgorithms to extract knowledge about the relationship among datarepresented as graphs. The proliferation of graph data (from sourcessuch as social media) has led to strong demand for and wide use of graphanalytics. As such, being able to do graph analytics as efficient aspossible is of critical importance.

To address this need, one implementation automatically maps auser-defined graph algorithm to a hardware accelerator architecture“template” that is customized to the given input graph algorithm. Theaccelerator may comprise the architectures described above and may beimplemented as a FPGA/ASIC, which can execute with extreme efficiency.In summary, one implementation includes:

(1) a hardware accelerator architecture template that is based on ageneralized sparse matrix vector multiply (GSPMV) accelerator. Itsupports arbitrary graph algorithm because it has been shown that graphalgorithm can be formulated as matrix operations.

(2) an automatic approach to map and tune a widely-used “vertex centric”graph programming abstraction to the architecture template.

There are existing sparse matrix multiply hardware accelerators, butthey do not support customizability to allow mapping of graphalgorithms.

One implementation of the design framework operates as follows.

(1) A user specifies a graph algorithm as “vertex programs” followingvertex-centric graph programming abstraction. This abstraction is chosenas an example here due to its popularity. A vertex program does notexpose hardware details, so users without hardware expertise (e.g., datascientists) can create it.

(2) Along with the graph algorithm in (1), one implementation of theframework accepts the following inputs:

a. The parameters of the target hardware accelerator to be generated(e.g., max amount of on-chip RAMs). These parameters may be provided bya user, or obtained from an existing library of known parameters whentargeting an existing system (e.g., a particular FPGA board).

b. Design optimization objectives (e.g., max performance, min area).

c. The properties of the target graph data (e.g., type of graph) or thegraph data itself. This is optional, and is used to aid in automatictuning.

(3) Given above inputs, one implementation of the framework performsauto-tuning to determine the set of customizations to apply to thehardware template to optimize for the input graph algorithm, map theseparameters onto the architecture template to produce an acceleratorinstance in synthesizable RTL, and conduct functional and performancevalidation of the generated RTL against the functional and performancesoftware models derived from the input graph algorithm specification.

In one implementation, the accelerator architecture described above isextended to support execution of vertex programs by (1) making it acustomizable hardware template and (2) supporting the functionalitiesneeded by vertex program. Based on this template, a design framework isdescribed to map a user-supplied vertex program to the hardware templateto produce a synthesizable RTL (e.g., Verilog) implementation instanceoptimized for the vertex program. The framework also performs automaticvalidation and tuning to ensure the produced RTL is correct andoptimized. There are multiple use cases for this framework. For example,the produced synthesizable RTL can be deployed in an FPGA platform(e.g., Xeon-FPGA) to efficiently execute the given vertex program. Or,it can be refined further to produce an ASIC implementation.

It has been shown that graphs can be represented as adjacency matrices,and graph processing can be formulated as sparse matrix operations.FIGS. 14a-14b shows an example of representing a graph as an adjacencymatrix. Each non-zero in the matrix represents an edge among two nodesin the graph. For example, a 1 in row 0 column 2 represents an edge fromnode A to C.

One of the most popular models for describing computations on graph datais the vertex programming model. One implementation supports the vertexprogramming model variant from Graphmat software framework, whichformulates vertex programs as generalized sparse matrix vector multiply(GSPMV). As shown in FIG. 14c , a vertex program consists of the typesof data associated with edges/vertices in the graph (edata/vdata),messages sent across vertices in the graph (mdata), and temporary data(tdata) (illustrated in the top portion of program code); and statelessuser-defined compute functions using pre-defined APIs that read andupdate the graph data (as illustrated in the bottom portion of programcode).

FIG. 14d illustrates exemplary program code for executing a vertexprogram. Edge data is represented as an adjacency matrix A (as in FIG.14b ), vertex data as vector y, and messages as sparse vector x. FIG.14e shows the GSPMV formulation, where the multiply( ) and add( )operations in SPMV is generalized by user-defined PROCESS_MSG( ) andREDUCE( ).

One observation here is that the GSPMV variant needed to execute vertexprogram performs a column-oriented multiplication of sparse matrix A(i.e., adjacency matrix) against a sparse vector x (i.e., messages) toproduce an output vector y (i.e., vertex data). This operation isreferred to as col_spMspV (previously described with respect to theabove accelerator).

Design Framework.

One implementation of the framework is shown in FIG. 15 which includes atemplate mapping component 1511, a validation component 1512 and anautomatic tuning component 1513. Its inputs are a user-specified vertexprogram 1501, design optimization goals 1503 (e.g., max performance, minarea), and target hardware design constraints 1502 (e.g., maximum amountof on-chip RAMs, memory interface width). As an optional input to aidautomatic-tuning, the framework also accepts graph data properties 1504(e.g., type=natural graph) or a sample graph data.

Given these inputs, the template mapping component 1511 of the frameworkmaps the input vertex program to a hardware accelerator architecturetemplate, and produces an RTL implementation 1505 of the acceleratorinstance optimized for executing the vertex program 1501. The automatictuning component 1513 performs automatic tuning 1513 to optimize thegenerated RTL for the given design objectives, while meeting thehardware design constraints. Furthermore, the validation component 1512automatically validates the generated RTL against functional andperformance models derived from the inputs. Validation test benches 1506and tuning reports 1507 are produced along with the RTL.

Generalized Sparse Matrix Vector Multiply (GSPMV) Hardware ArchitectureTemplate

One implementation of an architecture template for GSPMV is shown inFIG. 16, which is based on the accelerator architecture described above(see, e.g., FIG. 12 and associated text). Many of the componentsillustrated in FIG. 16 are customizable (as highlighted with greylines). In one implementation, the architecture to support execution ofvertex programs has been extended as follows.

As illustrated in FIG. 16, customizable logic blocks are provided insideeach PE to support PROCESS_MSG( ) 1910, REDUCE( ) 1611, APPLY 1612, andSEND_MSG( ) 1613 needed by the vertex program. In addition, oneimplementation provides customizable on-chip storage structures andpack/unpack logic 1605 to support user-defined graph data (i.e., vdata,edata, mdata, tdata). The data management unit 705 illustrated in FIG.16 includes a PE scheduler 1201 (for scheduling PEs as described above),aux buffers 1601 for storing active column, x data), a read buffer 1202,a memory controller 1603 for controlling access to system memory, and awrite buffer 1204. In addition, in the implementation shown in FIG. 16old and new vdata and tdata is stored within the local PE memory 1221.Various control state machines may be modified to support executingvertex programs, abiding to the functionalities specified by thealgorithms in FIGS. 14d and 14 e.

The operation of each accelerator tile is summarized in FIG. 17. At1701, the y vector (vdata) is loaded to the PE RAM 1221. At 1702, the xvector and column pointers are loaded to the aux buffer 1601. At 1703,for each x vector element, the A column is streamed in (edata) and thePEs execute PROC_MSG( ) 1610 and REDUCE( ) 1611. At 1704, the PEsexecute APPLY( ) 1612. At 1705, the PEs execute SEND_MSG( ) 1613,producing messages, and the data management unit 705 writes them as xvectors in memory. At 1706, the data management unit 705 writes theupdated y vectors (vdata) stored in the PE RAMs 1221 back to memory. Theabove techniques conform to the vertex program execution algorithm shownin FIGS. 14d and 14e . To scale up performance, the architecture allowsincreasing the number of PEs in a tile and/or the number of tiles in thedesign. This way, the architecture can take advantage of multiple levelsof parallelisms in the graph (i.e., across subgraphs (across blocks ofadjacency matrix) or within each subgraph). The Table in FIG. 18asummarizes the customizable parameters of one implementation of thetemplate. It is also possible to assign asymmetric parameters acrosstiles for optimization (e.g., one tile with more PEs than another tile).

Automatic Mapping, Validation, and Tuning

Tuning.

Based on the inputs, one implementation of the framework performsautomatic tuning to determine the best design parameters to use tocustomize the hardware architecture template in order to optimize it forthe input vertex program and (optionally) graph data. There are manytuning considerations, which are summarized in the table in FIG. 18b .As illustrated, these include locality of data, graph data sizes, graphcompute functions, graph data structure, graph data access attributes,graph data types, and graph data patterns.

Template Mapping.

In this phase, the framework takes the template parameters determined bythe tuning phase, and produces an accelerator instance by “filling” inthe customizable portions of the template. The user-defined computefunctions (e.g., FIG. 14c ) may be mapped from the input specificationto the appropriate PE compute blocks using existing High-Level Synthesis(HLS) tools. The storage structures (e.g., RAMs, buffers, cache) andmemory interfaces are instantiated using their corresponding designparameters. The pack/unpack logic may automatically be generated fromthe data type specifications (e.g., FIG. 14a ). Parts of the controlfinite state machines (FSMs) are also generated based on the provideddesign parameters (e.g., PE scheduling schemes).

Validation.

In one implementation, the accelerator architecture instance(synthesizable RTL) produced by the template mapping is thenautomatically validated. To do this, one implementation of the frameworkderives a functional model of the vertex program to be used as the“golden” reference. Test benches are generated to compare the executionof this golden reference against simulations of the RTL implementationof the architecture instance. The framework also performs performancevalidation by comparing RTL simulations against analytical performancemodel and cycle-accurate software simulator. It reports runtimebreakdown and pinpoint the bottlenecks of the design that affectperformance.

Accelerator Architecture for Processing Sparse Data

Introduction

Computations on sparse datasets—vectors or matrices most of whose valuesare zero—are critical to an increasing number of commercially-importantapplications, but typically achieve only a few percent of peakperformance when run on today's CPUs. In the scientific computing arena,sparse-matrix computations have been key kernels of linear solvers fordecades. More recently, the explosive growth of machine learning andgraph analytics has moved sparse computations into the mainstream.Sparse-matrix computations are central to many machine-learningapplications and form the core of many graph algorithms.

Sparse-matrix computations tend to be memory bandwidth-limited ratherthan compute-limited, making it difficult for CPU changes to improvetheir performance. They execute few operations per matrix data elementand often iterate over an entire matrix before re-using any data, makingcaches ineffective. In addition, many sparse-matrix algorithms containsignificant numbers of data-dependent gathers and scatters, such as theresult[row]+=matrix[row][i].value*vector[matrix[row][i].index] operationfound in sparse matrix-vector multiplication, which are hard to predictand reduce the effectiveness of prefetchers.

To deliver better sparse-matrix performance than conventionalmicroprocessors, a system must provide significantly higher memorybandwidth than current CPUs and a very energy-efficient computingarchitecture. Increasing memory bandwidth makes it possible to improveperformance, but the high energy/bit cost of DRAM accesses limits theamount of power available to process that bandwidth. Without anenergy-efficient compute architecture, a system might find itself in theposition of being unable to process the data from a high-bandwidthmemory system without exceeding its power budget.

One implementation comprises an accelerator for sparse-matrixcomputations which uses stacked DRAM to provide the bandwidth thatsparse-matrix algorithms require combined with a custom computearchitecture to process that bandwidth in an energy-efficient manner.

Sparse—Matrix Overview

Many applications create data sets where the vast majority of the valuesare zero. Finite-element methods model objects as a mesh of points wherethe state of each point is a function of the state of the points near itin the mesh. Mathematically, this becomes a system of equations that isrepresented as a matrix where each row describes the state of one pointand the values in the row are zero for all of the points that do notdirectly affect the state of the point the row describes. Graphs can berepresented as an adjacency matrix, where each element {i,j} in thematrix gives the weight of the edge between vertices i and j in thegraph. Since most vertexes connect to only a small fraction of the othervertices in the graph, the vast majority of the elements in theadjacency matrix are zeroes. In machine learning, models are typicallytrained using datasets that consist of many samples, each of whichcontains a set of features (observations of the state of a system orobject) and the desired output of the model for that set of features. Itis very common for most of the samples to only contain a small subset ofthe possible features, for example when the features represent differentwords that might be present in a document, again creating a datasetwhere most of the values are zero.

Datasets where most of the values are zero are described as “sparse,”and it is very common for sparse datasets to be extremely sparse, havingnon-zero values in less than 1% of their elements. These datasets areoften represented as matrices, using data structures that only specifythe values of the non-zero elements in the matrix. While this increasesthe amount of space required to represent each non-zero element, sinceit is necessary to specify both the element's location and its value,the overall space (memory) savings can be substantial if the matrix issparse enough. For example, one of the most straightforwardrepresentations of a sparse matrix is the coordinate list (COO)representation, in which each non-zero is specified by a {row index,column index, value} tuple. While this triples the amount of storagerequired for each non-zero value, if only 1% of the elements in a matrixhave non-zero values, the COO representation will take up only 3% of thespace that a dense representation (one that represents the value of eachelement in the matrix) would take.

FIG. 19 illustrates one of the most common sparse-matrix formats, thecompressed row storage (CRS, sometimes abbreviated CSR) format. In CRSformat, the matrix 1900 is described by three arrays: a values array1901, which contains the values of the non-zero elements, an indicesarray 1902, which specifies the position of each non-zero element withinits row of the matrix, and a row starts array 1903, which specifieswhere each row of the matrix starts in the lists of indices and values.Thus, the first non-zero element of the second row of the example matrixcan be found at position 2 in the indices and values arrays, and isdescribed by the tuple {0, 7}, indicating that the element occurs atposition 0 within the row and has value 7. Other commonly-usedsparse-matrix formats include compressed sparse column (CSC), which isthe column-major dual to CRS, and ELLPACK, which represents each row ofthe matrix as a fixed-width list of non-zero values and their indices,padding with explicit zeroes when a row has fewer non-zero elements thanthe longest row in the matrix.

Computations on sparse matrices have the same structure as theirdense-matrix counterparts, but the nature of sparse data tends to makethem much more bandwidth-intensive than their dense-matrix counterparts.For example, both the sparse and dense variants of matrix-matrixmultiplication find C=A·B by computing Ci,j=Ai,·B,j for all i, j. In adense matrix-matrix computation, this leads to substantial data re-use,because each element of A participates in N multiply-add operations(assuming N×N matrices), as does each element of B. As long as thematrix-matrix multiplication is blocked for cache locality, this re-usecauses the computation to have a low bytes/op ratio and to becompute-limited. However, in the sparse variant, each element of A onlyparticipates in as many multiply-add operations as there are non-zerovalues in the corresponding row of B, while each element of B onlyparticipates in as many multiply-adds as there are non-zero elements inthe corresponding column of A. As the sparseness of the matricesincreases, so does the bytes/op ratio, making the performance of manysparse matrix-matrix computations limited by memory bandwidth in spiteof the fact that dense matrix-matrix multiplication is one of thecanonical compute-bound computations.

Four operations make up the bulk of the sparse-matrix computations seenin today's applications: sparse matrix-dense vector multiplication(SpMV), sparse matrix-sparse vector multiplication, sparse matrix-sparsematrix multiplication, and relaxation/smoother operations, such as theGauss-Seidel smoother used in Intel's implementation of theHigh-Performance Conjugate Gradient benchmark. These operations sharetwo characteristics that make a sparse-matrix accelerator practical.First, they are dominated by vector dot-products, which makes itpossible to implement simple hardware that can implement all fourimportant computations. For example, a matrix-vector multiplication isperformed by taking the dot-product of each row in the matrix with thevector, while a matrix-matrix multiplication takes the dot-product ofeach row of one matrix with each column of the other. Second,applications generally perform multiple computations on the same matrix,such as the thousands of multi-plications of the same matrix bydifferent vectors that a support vector machine algorithm performs withtraining a model. This repeated use of the same matrix makes itpractical to transfer matrices to/from an accelerator during programexecution and/or to re-format the matrix in a way that simplifies thehardware's task, since the cost of data transfers/transformations can beamortized across many operations on each matrix.

Sparse-matrix computations typically achieve only a few percent of thepeak performance of the system they run on. To demonstrate why thisoccurs, FIG. 20 shows the steps 2001-2004 involved in an implementationof sparse matrix-dense vector multiplication using the CRS data format.First, at 2001, the data structure that represents a row of the matrixis read out of memory, which usually involves a set of sequential readsthat are easy to predict and prefetch. Second, at 2002, the indices ofthe non-zero elements in the matrix row are used to gather thecorresponding elements of the vector, which requires a number ofdata-dependent, hard-to-predict memory accesses (a gather operation).Moreover, these memory accesses often touch only one or two words ineach referenced cache line, resulting in significant wasted bandwidthwhen the vector does not fit in the cache.

Third, at 2003, the processor computes the dot-product of the non-zeroelements of the matrix row and the corresponding elements of the vector.Finally, at 2004, the result of the dot-product is written into theresult vector, which is also accessed sequentially, and the programproceeds to the next row of the matrix. Note that this is aconceptual/algorithmic view of the computation, and the exact sequenceof operations the program executes will depend on the processor's ISAand vector width.

This example illustrates a number of important characteristics ofsparse-matrix computations. Assuming 32-bit data types and that neitherthe matrix nor the vector fit in the cache, computing the first elementof the output row requires reading 36 bytes from DRAM, but only fivecompute instructions (three multiplies and two adds), for a bytes/opratio of 7.2:1.

Memory bandwidth is not the only challenge to high-performancesparse-matrix computations, however. As FIG. 20 shows, the accesses tothe vector in SpMV are data-dependent and hard to predict, exposing thelatency of vector accesses to the application. If the vector does notfit in the cache, SpMV performance becomes sensitive to DRAM latency aswell as bandwidth unless the processor provides enough parallelism tosaturate the DRAM bandwidth even when many threads are stalled waitingfor data.

Thus, an architecture for sparse-matrix computations must provideseveral things to be effective. It must deliver high memory bandwidth tomeet the bytes/op needs of sparse computations. It must also supporthigh-bandwidth gathers out of large vectors that may not fit in thecache. Finally, while performing enough arithmetic operations/second tokeep up with DRAM bandwidth is not a challenge in and of itself, thearchitecture must perform those operations and all of the memoryaccesses they require in an energy-efficient manner in order to remainwithin system power budgets.

Implementations

One implementation comprises an accelerator designed to provide thethree features necessary for high sparse-matrix performance: high memorybandwidth, high-bandwidth gathers out of large vectors, andenergy-efficient computation. As illustrated in FIG. 21, oneimplementation of the accelerator includes an accelerator logic die 2105and one of more stacks 2101-2104 of DRAM die. Stacked DRAM, which isdescribed in more detail below, provides high memory bandwidth at lowenergy/bit. For example, stacked DRAMs are expected to deliver 256-512GB/sec at 2.5 pJ/bit, while LPDDR4 DIMMs are only expected to deliver 68GB/sec and will have an energy cost of 12 pJ/bit.

The accelerator logic chip 2105 at the bottom of the accelerator stackis customized to the needs of sparse-matrix computations, and is able toconsume the bandwidth offered by a DRAM stack 2101-2104 while onlyexpending 2-4 Watts of power, with energy consumption proportional tothe bandwidth of the stack. To be conservative, a stack bandwidth of 273GB/sec is assumed (the expected bandwidth of WIO3 stacks) for theremainder of this application. Designs based on higher-bandwidth stackswould incorporate more parallelism in order to consume the memorybandwidth.

FIG. 22 illustrates one implementation of the accelerator logic chip2105, oriented from a top perspective through the stack of DRAM die2101-2104. The stack DRAM channel blocks 2205 towards the center of thediagram represent the through-silicon vias that connect the logic chip2105 to the DRAMs 2101-2104, while the memory controller blocks 1210contain the logic that generates the control signals for the DRAMchannels. While eight DRAM channels 2205 are shown in the figure, theactual number of channels implemented on an accelerator chip will varydepending on the stacked DRAMs used. Most of the stack DRAM technologiesbeing developed provide either four or eight channels.

The dot-product engines (DPEs) 2220 are the computing elements of thearchitecture. In the particular implementation shown in FIG. 22, eachset of eight DPEs is associated with a vector cache 2215. FIG. 23provides a high-level overview of a DPE which contains two buffers2305-2306, two 64-bit multiply-add ALUs 2310, and control logic 2300.During computations, the chip control unit 2300 streams chunks of thedata being processed into the buffer memories 2305-2306. Once eachbuffer is full, the DPE's control logic sequences through the buffers,computing the dot-products of the vectors they contain and writing theresults out to the DPE's result latch 2310, which is connected in adaisy-chain with the result latches of the other DPE's to write theresult of a computation back to the stack DRAM 2101-2104.

In one implementation, the accelerator logic chip 2405 operates atapproximately 1 GHz and 0.65V to minimize power consumption (althoughthe particular operating frequency and voltage may be modified fordifferent applications). Analysis based on 14 nm design studies showsthat 32-64 KB buffers meet this frequency spec at that voltage, althoughstrong ECC may be required to prevent soft errors. The multiply-add unitmay be operated at half of the base clock rate in order to meet timingwith a 0.65V supply voltage and shallow pipeline. Having two ALUsprovides a throughput of one double-precision multiply-add/cycle perDPE.

At 273 GB/second and a clock rate of 1.066 MHz, the DRAM stack 2101-2104delivers 256 bytes of data per logic chip clock cycle. Assuming thatarray indices and values are at least 32-bit quantities, this translatesto 32 sparse-matrix elements per cycle (4 bytes of index+4 bytes ofvalue=8 bytes/element), requiring that the chip perform 32 multiply-addsper cycle to keep up. (This is for matrix-vector multiplication andassumes a high hit rate in the vector cache so that 100% of the stackDRAM bandwidth is used to fetch the matrix.) The 64 DPEs shown in FIG.22 provide 2-4× the required compute throughput, allowing the chip toprocess data at the peak stack DRAM bandwidth even if the ALUs 2310 arenot used 100% of the time.

In one implementation, the vector caches 2215 cache elements of thevector in a matrix-vector multiplication. This significantly increasesthe efficiency of the matrix-blocking scheme described below. In oneimplementation, each vector cache block contains 32-64 KB of cache, fora total capacity of 256-512 KB in an eight-channel architecture.

The chip control unit 2201 manages the flow of a computation and handlescommunication with the other stacks in an accelerator and with othersockets in the system. To reduce complexity and power consumption, thedot-product engines never request data from memory. Instead, the chipcontrol unit 2201 manages the memory system, initiating transfers thatpush the appropriate blocks of data to each of the DPEs.

In one implementation, the stacks in a multi-stack acceleratorcommunicate with each other via a network of KTI links 2230 that isimplemented using the neighbor connections 2231 shown in the figure. Thechip also provides three additional KTI links that are used tocommunicate with the other socket(s) in a multi-socket system. In amulti-stack accelerator, only one of the stacks' off-package KTI links2230 will be active. KTI transactions that target memory on the otherstacks will be routed to the appropriate stack over the on-package KTInetwork.

Implementing Sparse-Matrix Operations

In this section, we describe the techniques and hardware required toimplement sparse matrix-dense vector and sparse matrix-sparse vectormultiplication on one implementation of the accelerator. This design isalso extended to support matrix-matrix multiplication, relaxationoperations, and other important functions to create an accelerator thatsupports all of the key sparse-matrix operations.

While sparse-sparse and sparse-dense matrix-vector multiplicationsexecute the same basic algorithm (taking the dot product of each row inthe matrix and the vector), there are significant differences in howthis algorithm is implemented when the vector is sparse as compared towhen it is dense, which are summarized in Table 1 below.

TABLE 1 Sparse-Sparse Sparse-Dense SpMV SpMV Size of Vector TypicallySmall Often large (5-10% of matrix size) Location of Vector ElementsUnpredictable Determined by Index Number of operations per UnpredictableFixed matrix element

In a sparse matrix-dense vector multiplication, the size of the vectoris fixed and equal to the number of columns in the matrix. Since many ofthe matrices found in scientific computations average approximately 10non-zero elements per row, it is not uncommon for the vector in a sparsematrix-dense vector multiplication to take up 5-10% as much space as thematrix itself. Sparse vectors, on the other hand, are often fairlyshort, containing similar numbers of non-zero values to the rows of thematrix, which makes them much easier to cache in on-chip memory.

In a sparse matrix-dense vector multiplication the location of eachelement in the vector is determined by its index, making it feasible togather the vector elements that correspond to the non-zero values in aregion of the matrix and to pre-compute the set of vector elements thatneed to be gathered for any dense vector that the matrix will bemultiplied by. The location of each element in a sparse vector, howeveris unpredictable and depends on the distribution of non-zero elements inthe vector. This makes it necessary to examine the non-zero elements ofthe sparse vector and of the matrix to determine which non-zeroes in thematrix correspond to non-zero values in the vector.

It is helpful to compare the indices of the non-zero elements in thematrix and the vector because the number of instructions/operationsrequired to compute a sparse matrix-sparse vector dot-product isunpredictable and depends on the structure of the matrix and vector. Forexample, consider taking the dot-product of a matrix row with a singlenon-zero element and a vector with many non-zero elements. If the row'snon-zero has a lower index than any of the non-zeroes in the vector, thedot-product only requires one index comparison. If the row's non-zerohas a higher index than any of the non-zeroes in the vector, computingthe dot-product requires comparing the index of the row's non-zero withevery index in the vector. This assumes a linear search through thevector, which is common practice. Other searches, such as binary search,would be faster in the worst case, but would add significant overhead inthe common case where the non-zeroes in the row and the vector overlap.In contrast, the number of operations required to perform a sparsematrix-dense vector multiplication is fixed and determined by the numberof non-zero values in the matrix, making it easy to predict the amountof time required for the computation.

Because of these differences, one implementation of the accelerator usesthe same high-level algorithm to implement sparse matrix-dense vectorand sparse matrix-sparse vector multiplication, with differences in howthe vector is distributed across the dot-product engines and how thedot-product is computed. Because the accelerator is intended for largesparse-matrix computations, it cannot be assumed that either the matrixor the vector will fit in on-chip memory. Instead, one implementationuses the blocking scheme outlined in FIG. 24.

In particular, in this implementation, the accelerator will dividematrices into fixed-size blocks of data 2401-2402, sized to fit in theon-chip memory, and will multiply the rows in the block by the vector togenerate a chunk of the output vector before proceeding to the nextblock. This approach poses two challenges. First, the number ofnon-zeroes in each row of a sparse matrix varies widely betweendatasets, from as low as one to as high as 46,000 in the datasetsstudied. This makes it impractical to assign one or even a fixed numberof rows to each dot-product engine. Therefore, one implementationassigns fixed-size chunks of matrix data to each dot product engine andhandles the case where a chunk contains multiple matrix rows and thecase where a single row is split across multiple chunks.

The second challenge is that fetching the entire vector from stack DRAMfor each block of the matrix has the potential to waste significantamounts of bandwidth (i.e., fetching vector elements for which there isno corresponding non-zero in the block). This is particularly an issuefor sparse matrix-dense vector multiplication, where the vector can be asignificant fraction of the size of the sparse matrix. To address this,one implementation constructs a fetch list 2411-2412 for each block2401-2402 in the matrix, which lists the set of vector 2410 elementsthat correspond to non-zero values in the block, and only fetch thoseelements when processing the block. While the fetch lists must also befetched from stack DRAM, it has been determined that the fetch list formost blocks will be a small fraction of the size of the block.Techniques such as run-length encodings may also be used to reduce thesize of the fetch list.

Thus, a matrix-vector multiplication on Accelerator will involve thefollowing sequence of operations:

1. Fetch a block of matrix data from the DRAM stack and distribute itacross the dot-product engines;

2. Generate fetch list based on non-zero elements in the matrix data;

3. Fetch each vector element in the fetch list from stack DRAM anddistribute it to the dot-product engines;

4. Compute the dot-product of the rows in the block with the vector andwrite the results out to stack DRAM; and

5. In parallel with the computation, fetch the next block of matrix dataand repeat until the entire matrix has been processed.

When an accelerator contains multiple stacks, “partitions” of the matrixmay be statically assigned to the different stacks and then the blockingalgorithm may be executed in parallel on each partition. This blockingand broadcast scheme has the advantage that all of the memory referencesoriginate from a central control unit, which greatly simplifies thedesign of the on-chip network, since the network does not have to routeunpredictable requests and replies between the dot product engines andthe memory controllers. It also saves energy by only issuing one memoryrequest for each vector element that a given block needs, as opposed tohaving individual dot product engines issue memory requests for thevector elements that they require to perform their portion of thecomputation. Finally, fetching vector elements out of an organized listof indices makes it easy to schedule the memory requests that thosefetches require in a way that maximizes page hits in the stacked DRAMand thus bandwidth usage.

Implementing Sparse Matrix-Dense Vector Multiplication

One challenge in implementing sparse matrix-dense vector multiplicationon the accelerator implementations described herein is matching thevector elements being streamed from memory to the indices of the matrixelements in each dot-product engine's buffers. In one implementation,256 bytes (32-64 elements) of the vector arrive at the dot-productengine per cycle, and each vector element could correspond to any of thenon-zeroes in the dot-product engine's matrix buffer since fixed-sizeblocks of matrix data were fetched into each dot-product engine's matrixbuffer.

Performing that many comparisons each cycle would be prohibitivelyexpensive in area and power. Instead, one implementation takes advantageof the fact that many sparse-matrix applications repeatedly multiply thesame matrix by either the same or different vectors and pre-compute theelements of the fetch list that each dot-product engine will need toprocess its chunk of the matrix, using the format shown in FIG. 25. Inthe baseline CRS format, a matrix is described by an array of indices2502 that define the position of each non-zero value within its row, anarray containing the values of each non-zero 2503, and an array 2501that indicates where each row starts in the index and values arrays. Tothat, one implementation adds an array of block descriptors 2505 thatidentify which bursts of vector data each dot-product engine needs tocapture in order to perform its fraction of the overall computation.

As shown in FIG. 25, each block descriptor consists of eight 16-bitvalues and a list of burst descriptors. The first 16-bit value tells thehardware how many burst descriptors are in the block descriptor, whilethe remaining seven identify the start points within the burstdescriptor list for all of the stack DRAM data channels except thefirst. The number of these values will change depending on the number ofdata channels the stacked DRAM provides. Each burst descriptor containsa 24-bit burst count that tells the hardware which burst of data itneeds to pay attention to and a “Words Needed” bit-vector thatidentifies the words within the burst that contain values thedot-processing engine needs.

The other data structure included in one implementation is an array ofmatrix buffer indices (MBIs) 2504, one MBI per non-zero in the matrix.Each MBI gives the position at which the dense vector element thatcorresponds to the non-zero will be stored in the relevant dot-productengine's vector value buffer (see, e.g., FIG. 27). When performing asparse matrix-dense vector multiplication, the matrix buffer indices,rather than the original matrix indices, are loaded into the dot-productengine's matrix index buffer 2504, and serve as the address used to lookup the corresponding vector value when computing the dot product.

FIG. 26 illustrates how this works for a two-row matrix that fits withinthe buffers of a single dot-product engine, on a system with only onestacked DRAM data channel and four-word data bursts. The original CRSrepresentation including row start values 2601, matrix indices 2602 andmatrix values 2603 are shown on the left of the figure. Since the tworows have non-zero elements in columns {2, 5, 6} and {2, 4, 5}, elements2, 4, 5, and 6 of the vector are required to compute the dot-products.The block descriptors reflect this, indicating that word 2 of the firstfour-word burst (element 2 of the vector) and words 0, 1, and 2 of thesecond four-word burst (elements 4-6 of the vector) are required. Sinceelement 2 of the vector is the first word of the vector that thedot-product engine needs, it will go in location 0 in the vector valuebuffer. Element 4 of the vector will go in location 1, and so on.

The matrix buffer index array data 2604 holds the location within thevector value buffer where the hardware will find the value thatcorresponds to the non-zero in the matrix. Since the first entry in thematrix indices array has value “2”, the first entry in the matrix bufferindices array gets the value “0”, corresponding to the location whereelement 2 of the vector will be stored in the vector value buffer.Similarly, wherever a “4” appears in the matrix indices array, a “1”will appear in the matrix buffer indices, each “5” in the matrix indicesarray will have a corresponding “2” in the matrix buffer indices, andeach “6” in the matrix indices array will correspond to a “3” in thematrix buffer indices.

One implementation of the invention performs the pre-computationsrequired to support fast gathers out of dense vectors when a matrix isloaded onto the accelerator, taking advantage of the fact that the totalbandwidth of a multi-stack accelerator is much greater than thebandwidth of the KTI links used to transfer data from the CPU to theaccelerator. This pre-computed information increases the amount ofmemory required to hold a matrix by up to 75%, depending on how oftenmultiple copies of the same matrix index occur within the chunk of thematrix mapped onto a dot-product engine. However, because the 16-bitmatrix buffer indices array is fetched instead of the matrix indicesarray when a matrix-vector multiplication is performed, the amount ofdata fetched out of the stack DRAMs will often be less than in theoriginal CRS representation, particularly for matrices that use 64-bitindices.

FIG. 27 illustrates one implementation of the hardware in a dot-productengine that uses this format. To perform a matrix-vector multiplication,the chunks of the matrix that make up a block are copied into the matrixindex buffer 3003 and matrix value buffer 3005 (copying the matrixbuffer indices instead of the original matrix indices), and the relevantblock descriptor is copied into the block descriptor buffer 3002. Then,the fetch list is used to load the required elements from the densevector and broadcast them to the dot-product engines. Each dot-productengine counts the number of bursts of vector data that go by on eachdata channel. When the count on a given data channel matches the valuespecified in a burst descriptor, the match logic 3020 captures thespecified words and stores them in its vector value buffer 3004.

FIG. 28 shows the contents of the match logic 3020 unit that does thiscapturing. A latch 3105 captures the value on the data channel's wireswhen the counter matches the value in the burst descriptor. A shifter3106 extracts the required words 3102 out of the burst 3101 and routesthem to the right location in a line buffer 3107 whose size matches therows in the vector value buffer. A load signal is generated when theburst count 3101 is equal to an internal counter 3104. When the linebuffer fills up, it is stored in the vector value buffer 3004 (throughmux 3108). Assembling the words from multiple bursts into lines in thisway reduces the number of writes/cycle that the vector value bufferneeds to support, reducing its size.

Once all of the required elements of the vector have been captured inthe vector value buffer, the dot-product engine computes the requireddot-product(s) using the ALUs 3010. The control logic 3001 steps throughthe matrix index buffer 3003 and matrix value buffer 3004 in sequence,one element per cycle. The output of the matrix index buffer 3003 isused as the read address for the vector value buffer 3004 on the nextcycle, while the output of the matrix value buffer 3004 is latched sothat it reaches the ALUs 3010 at the same time as the correspondingvalue from the vector value buffer 3004. For example, using the matrixfrom FIG. 26, on the first cycle of the dot-product computation, thehardware would read the matrix buffer index “0” out of the matrix indexbuffer 3003 along with the value “13” from the matrix value buffer 3005.On the second cycle, the value “0” from the matrix index buffer 3003acts as the address for the vector value buffer 3004, fetching the valueof vector element “2”, which is then multiplied by “13” on cycle 3.

The values in the row starts bit-vector 2901 tell the hardware when arow of the matrix ends and a new one begins. When the hardware reachesthe end of the row, it places the accumulated dot-product for the row inits output latch 3011 and begins accumulating the dot-product for thenext row. The dot-product latches of each dot-product engine areconnected in a daisy chain that assembles the output vector forwriteback.

Implementing Sparse Matrix-Sparse Vector Multiplication

In sparse matrix-sparse vector multiplication, the vector tends to takeup much less memory than in sparse matrix-dense vector multiplication,but, because it is sparse, it is not possible to directly fetch thevector element that corresponds to a given index. Instead, the vectormust be searched, making it impractical to route only the elements thateach dot-product engine needs to the dot-product engine and making theamount of time required to compute the dot-products of the matrix dataassigned to each dot-product engine unpredictable. Because of this, thefetch list for a sparse matrix-sparse vector multiplication merelyspecifies the index of the lowest and highest non-zero elements in thematrix block and all of the non-zero elements of the vector betweenthose points must be broadcast to the dot-product engines.

FIG. 29 shows the details of a dot-product engine design to supportsparse matrix-sparse vector multiplication. To process a block of matrixdata, the indices (not the matrix buffer indices used in a sparse-densemultiplication) and values of the dot-product engine's chunk of thematrix are written into the matrix index and value buffers, as are theindices and values of the region of the vector required to process theblock. The dot-product engine control logic 2940 then sequences throughthe index buffers 2902-2903, which output blocks of four indices to the4×4 comparator 2920. The 4×4 comparator 2920 compares each of theindices from the vector 2902 to each of the indices from the matrix2903, and outputs the buffer addresses of any matches into the matchedindex queue 2930. The outputs of the matched index queue 2930 drive theread address inputs of the matrix value buffer 2905 and vector valuebuffer 2904, which output the values corresponding to the matches intothe multiply-add ALU 2910. This hardware allows the dot-product engineto consume at least four and as many as eight indices per cycle as longas the matched index queue 2930 has empty space, reducing the amount oftime required to process a block of data when index matches are rare.

As with the sparse matrix-dense vector dot-product engine, a bit-vectorof row starts 2901 identifies entries in the matrix buffers 2992-2903that start a new row of the matrix. When such an entry is encountered,the control logic 2940 resets to the beginning of the vector indexbuffer ATA3202 and starts examining vector indices from their lowestvalue, comparing them to the outputs of the matrix index buffer 2903.Similarly, if the end of the vector is reached, the control logic 2940advances to the beginning of the next row in the matrix index buffer2903 and resets to the beginning of the vector index buffer 2902. A“done” output informs the chip control unit when the dot-product enginehas finished processing a block of data or a region of the vector and isready to proceed to the next one. To simplify one implementation of theaccelerator, the control logic 2940 will not proceed to the nextblock/region until all of the dot-product engines have finishedprocessing.

In many cases, the vector buffers will be large enough to hold all ofthe sparse vector that is required to process the block. In oneimplementation, buffer space for 1,024 or 2,048 vector elements isprovided, depending on whether 32- or 64-bit values are used.

When the required elements of the vector do not fit in the vectorbuffers, a multipass approach may be used. The control logic 2940 willbroadcast a full buffer of the vector into each dot-product engine,which will begin iterating through the rows in its matrix buffers. Whenthe dot-product engine reaches the end of the vector buffer beforereaching the end of the row, it will set a bit in the current rowposition bit-vector 2911 to indicate where it should resume processingthe row when the next region of the vector arrives, will save thepartial dot-product it has accumulated in the location of the matrixvalues buffer 2905 corresponding to the start of the row unless thestart of the row has a higher index value than any of the vector indicesthat have been processed so far, and will advance to the next row. Afterall of the rows in the matrix buffer have been processed, thedot-product engine will assert its done signal to request the nextregion of the vector, and will repeat the process until the entirevector has been read.

FIG. 30 illustrates an example using specific values. At the start ofthe computation 3001, a four-element chunk of the matrix has beenwritten into the matrix buffers 2903, 2905, and a four-element region ofthe vector has been written into the vector buffers 2902, 2904. The rowstarts 2901 and current row position bit-vectors 2911 both have thevalue “1010,” indicating that the dot-product engine's chunk of thematrix contains two rows, one of which starts at the first element inthe matrix buffer, and one of which starts at the third.

When the first region is processed, the first row in the chunk sees anindex match at index 3, computes the product of the correspondingelements of the matrix and vector buffers (4×1=4) and writes that valueinto the location of the matrix value buffer 2905 that corresponds tothe start of the row. The second row sees one index match at index 1,computes the product of the corresponding elements of the vector andmatrix, and writes the result (6) into the matrix value buffer 2905 atthe position corresponding to its start. The state of the current rowposition bit-vector changes to “0101,” indicating that the first elementof each row has been processed and the computation should resume withthe second elements. The dot-product engine then asserts its done lineto signal that it is ready for another region of the vector.

When the dot-product engine processes the second region of the vector,it sees that row 1 has an index match at index 4, computes the productof the corresponding values of the matrix and vector (5×2=10), adds thatvalue to the partial dot-product that was saved after the first vectorregion was processed, and outputs the result (14). The second row findsa match at index 7, and outputs the result 38, as shown in the figure.Saving the partial dot-products and state of the computation in this wayavoids redundant work processing elements of the matrix that cannotpossibly match indices in later regions of the vector (because thevector is sorted with indices in ascending order), without requiringsignificant amounts of extra storage for partial products.

Unified Dot-Product Engine Design

FIG. 31 shows how the sparse-dense and sparse-sparse dot-product enginesdescribed above are combined to yield a dot-product engine that canhandle both types of computations. Given the similarity between the twodesigns, the only required changes are to instantiate both thesparse-dense dot-product engine's match logic 3111 and the sparse-sparsedot-product engine's comparator 3120 and matched index queue 3130, alongwith a set of multiplexors 3150 that determine which modules drive theread address and write data inputs of the buffers 2904-2905 and amultiplexor 3151 that selects whether the output of the matrix valuebuffer or the latched output of the matrix value buffer is sent to themultiply-add ALUs 2910. In one implementation, these multiplexors arecontrolled by a configuration bit in the control unit 2940 that is setat the beginning of a matrix-vector multiplication and remain in thesame configuration throughout the operation.

Instruction Sets

An instruction set may include one or more instruction formats. A giveninstruction format may define various fields (e.g., number of bits,location of bits) to specify, among other things, the operation to beperformed (e.g., opcode) and the operand(s) on which that operation isto be performed and/or other data field(s) (e.g., mask). Someinstruction formats are further broken down though the definition ofinstruction templates (or subformats). For example, the instructiontemplates of a given instruction format may be defined to have differentsubsets of the instruction format's fields (the included fields aretypically in the same order, but at least some have different bitpositions because there are less fields included) and/or defined to havea given field interpreted differently. Thus, each instruction of an ISAis expressed using a given instruction format (and, if defined, in agiven one of the instruction templates of that instruction format) andincludes fields for specifying the operation and the operands. Forexample, an exemplary ADD instruction has a specific opcode and aninstruction format that includes an opcode field to specify that opcodeand operand fields to select operands (source1/destination and source2);and an occurrence of this ADD instruction in an instruction stream willhave specific contents in the operand fields that select specificoperands. A set of SIMD extensions referred to as the Advanced VectorExtensions (AVX) (AVX1 and AVX2) and using the Vector Extensions (VEX)coding scheme has been released and/or published (e.g., see Intel® 64and IA-32 Architectures Software Developer's Manual, September 2014; andsee Intel® Advanced Vector Extensions Programming Reference, October2014).

Exemplary Register Architecture

FIG. 32 is a block diagram of a register architecture 3200 according toone embodiment of the invention. In the embodiment illustrated, thereare 32 vector registers 3210 that are 512 bits wide; these registers arereferenced as zmm0 through zmm31. The lower order 256 bits of the lower16 zmm registers are overlaid on registers ymm0-16. The lower order 128bits of the lower 16 zmm registers (the lower order 128 bits of the ymmregisters) are overlaid on registers xmm0-15.

Write mask registers 3215—in the embodiment illustrated, there are 8write mask registers (k0 through k7), each 64 bits in size. In analternate embodiment, the write mask registers 3215 are 16 bits in size.As previously described, in one embodiment of the invention, the vectormask register k0 cannot be used as a write mask; when the encoding thatwould normally indicate k0 is used for a write mask, it selects ahardwired write mask of 0xFFFF, effectively disabling write masking forthat instruction.

General-purpose registers 3225—in the embodiment illustrated, there aresixteen 64-bit general-purpose registers that are used along with theexisting x86 addressing modes to address memory operands. Theseregisters are referenced by the names RAX, RBX, RCX, RDX, RBP, RSI, RDI,RSP, and R8 through R15.

Scalar floating point stack register file (x87 stack) 3245, on which isaliased the MMX packed integer flat register file 3250—in the embodimentillustrated, the x87 stack is an eight-element stack used to performscalar floating-point operations on 32/64/80-bit floating point datausing the x87 instruction set extension; while the MMX registers areused to perform operations on 64-bit packed integer data, as well as tohold operands for some operations performed between the MMX and XMMregisters.

Alternative embodiments of the invention may use wider or narrowerregisters. Additionally, alternative embodiments of the invention mayuse more, less, or different register files and registers.

Exemplary Core Architectures, Processors, and Computer Architectures

Processor cores may be implemented in different ways, for differentpurposes, and in different processors. For instance, implementations ofsuch cores may include: 1) a general purpose in-order core intended forgeneral-purpose computing; 2) a high performance general purposeout-of-order core intended for general-purpose computing; 3) a specialpurpose core intended primarily for graphics and/or scientific(throughput) computing. Implementations of different processors mayinclude: 1) a CPU including one or more general purpose in-order coresintended for general-purpose computing and/or one or more generalpurpose out-of-order cores intended for general-purpose computing; and2) a coprocessor including one or more special purpose cores intendedprimarily for graphics and/or scientific (throughput). Such differentprocessors lead to different computer system architectures, which mayinclude: 1) the coprocessor on a separate chip from the CPU; 2) thecoprocessor on a separate die in the same package as a CPU; 3) thecoprocessor on the same die as a CPU (in which case, such a coprocessoris sometimes referred to as special purpose logic, such as integratedgraphics and/or scientific (throughput) logic, or as special purposecores); and 4) a system on a chip that may include on the same die thedescribed CPU (sometimes referred to as the application core(s) orapplication processor(s)), the above described coprocessor, andadditional functionality. Exemplary core architectures are describednext, followed by descriptions of exemplary processors and computerarchitectures.

Exemplary Core Architectures

In-Order and Out-of-Order Core Block Diagram

FIG. 33A is a block diagram illustrating both an exemplary in-orderpipeline and an exemplary register renaming, out-of-orderissue/execution pipeline according to embodiments of the invention. FIG.33B is a block diagram illustrating both an exemplary embodiment of anin-order architecture core and an exemplary register renaming,out-of-order issue/execution architecture core to be included in aprocessor according to embodiments of the invention. The solid linedboxes in FIGS. 33A-B illustrate the in-order pipeline and in-order core,while the optional addition of the dashed lined boxes illustrates theregister renaming, out-of-order issue/execution pipeline and core. Giventhat the in-order aspect is a subset of the out-of-order aspect, theout-of-order aspect will be described.

In FIG. 33A, a processor pipeline 3300 includes a fetch stage 3302, alength decode stage 3304, a decode stage 3306, an allocation stage 3308,a renaming stage 3310, a scheduling (also known as a dispatch or issue)stage 3312, a register read/memory read stage 3314, an execute stage3316, a write back/memory write stage 3318, an exception handling stage3322, and a commit stage 3324.

FIG. 33B shows processor core 3390 including a front end unit 3330coupled to an execution engine unit 3350, and both are coupled to amemory unit 3370. The core 3390 may be a reduced instruction setcomputing (RISC) core, a complex instruction set computing (CISC) core,a very long instruction word (VLIW) core, or a hybrid or alternativecore type. As yet another option, the core 3390 may be a special-purposecore, such as, for example, a network or communication core, compressionengine, coprocessor core, general purpose computing graphics processingunit (GPGPU) core, graphics core, or the like.

The front end unit 3330 includes a branch prediction unit 3332 coupledto an instruction cache unit 3334, which is coupled to an instructiontranslation lookaside buffer (TLB) 3336, which is coupled to aninstruction fetch unit 3338, which is coupled to a decode unit 3340. Thedecode unit 3340 (or decoder) may decode instructions, and generate asan output one or more micro-operations, micro-code entry points,microinstructions, other instructions, or other control signals, whichare decoded from, or which otherwise reflect, or are derived from, theoriginal instructions. The decode unit 3340 may be implemented usingvarious different mechanisms. Examples of suitable mechanisms include,but are not limited to, look-up tables, hardware implementations,programmable logic arrays (PLAs), microcode read only memories (ROMs),etc. In one embodiment, the core 3390 includes a microcode ROM or othermedium that stores microcode for certain macroinstructions (e.g., indecode unit 3340 or otherwise within the front end unit 3330). Thedecode unit 3340 is coupled to a rename/allocator unit 3352 in theexecution engine unit 3350.

The execution engine unit 3350 includes the rename/allocator unit 3352coupled to a retirement unit 3354 and a set of one or more schedulerunit(s) 3356. The scheduler unit(s) 3356 represents any number ofdifferent schedulers, including reservations stations, centralinstruction window, etc. The scheduler unit(s) 3356 is coupled to thephysical register file(s) unit(s) 3358. Each of the physical registerfile(s) units 3358 represents one or more physical register files,different ones of which store one or more different data types, such asscalar integer, scalar floating point, packed integer, packed floatingpoint, vector integer, vector floating point, status (e.g., aninstruction pointer that is the address of the next instruction to beexecuted), etc. In one embodiment, the physical register file(s) unit3358 comprises a vector registers unit, a write mask registers unit, anda scalar registers unit. These register units may provide architecturalvector registers, vector mask registers, and general purpose registers.The physical register file(s) unit(s) 3358 is overlapped by theretirement unit 3354 to illustrate various ways in which registerrenaming and out-of-order execution may be implemented (e.g., using areorder buffer(s) and a retirement register file(s); using a futurefile(s), a history buffer(s), and a retirement register file(s); using aregister maps and a pool of registers; etc.). The retirement unit 3354and the physical register file(s) unit(s) 3358 are coupled to theexecution cluster(s) 3360. The execution cluster(s) 3360 includes a setof one or more execution units 3362 and a set of one or more memoryaccess units 3364. The execution units 3362 may perform variousoperations (e.g., shifts, addition, subtraction, multiplication) and onvarious types of data (e.g., scalar floating point, packed integer,packed floating point, vector integer, vector floating point). Whilesome embodiments may include a number of execution units dedicated tospecific functions or sets of functions, other embodiments may includeonly one execution unit or multiple execution units that all perform allfunctions. The scheduler unit(s) 3356, physical register file(s) unit(s)3358, and execution cluster(s) 3360 are shown as being possibly pluralbecause certain embodiments create separate pipelines for certain typesof data/operations (e.g., a scalar integer pipeline, a scalar floatingpoint/packed integer/packed floating point/vector integer/vectorfloating point pipeline, and/or a memory access pipeline that each havetheir own scheduler unit, physical register file(s) unit, and/orexecution cluster—and in the case of a separate memory access pipeline,certain embodiments are implemented in which only the execution clusterof this pipeline has the memory access unit(s) 3364). It should also beunderstood that where separate pipelines are used, one or more of thesepipelines may be out-of-order issue/execution and the rest in-order.

The set of memory access units 3364 is coupled to the memory unit 3370,which includes a data TLB unit 3372 coupled to a data cache unit 3374coupled to a level 2 (L2) cache unit 3376. In one exemplary embodiment,the memory access units 3364 may include a load unit, a store addressunit, and a store data unit, each of which is coupled to the data TLBunit 3372 in the memory unit 3370. The instruction cache unit 3334 isfurther coupled to a level 2 (L2) cache unit 3376 in the memory unit3370. The L2 cache unit 3376 is coupled to one or more other levels ofcache and eventually to a main memory.

By way of example, the exemplary register renaming, out-of-orderissue/execution core architecture may implement the pipeline 3300 asfollows: 1) the instruction fetch 3338 performs the fetch and lengthdecoding stages 3302 and 3304; 2) the decode unit 3340 performs thedecode stage 3306; 3) the rename/allocator unit 3352 performs theallocation stage 3308 and renaming stage 3310; 4) the scheduler unit(s)3356 performs the schedule stage 3312; 5) the physical register file(s)unit(s) 3358 and the memory unit 3370 perform the register read/memoryread stage 3314; the execution cluster 3360 perform the execute stage3316; 6) the memory unit 3370 and the physical register file(s) unit(s)3358 perform the write back/memory write stage 3318; 7) various unitsmay be involved in the exception handling stage 3322; and 8) theretirement unit 3354 and the physical register file(s) unit(s) 3358perform the commit stage 3324.

The core 3390 may support one or more instructions sets (e.g., the x86instruction set (with some extensions that have been added with newerversions); the MIPS instruction set of MIPS Technologies of Sunnyvale,Calif.; the ARM instruction set (with optional additional extensionssuch as NEON) of ARM Holdings of Sunnyvale, Calif.), including theinstruction(s) described herein. In one embodiment, the core 3390includes logic to support a packed data instruction set extension (e.g.,AVX1, AVX2), thereby allowing the operations used by many multimediaapplications to be performed using packed data.

It should be understood that the core may support multithreading(executing two or more parallel sets of operations or threads), and maydo so in a variety of ways including time sliced multithreading,simultaneous multithreading (where a single physical core provides alogical core for each of the threads that physical core issimultaneously multithreading), or a combination thereof (e.g., timesliced fetching and decoding and simultaneous multithreading thereaftersuch as in the Intel® Hyperthreading technology).

While register renaming is described in the context of out-of-orderexecution, it should be understood that register renaming may be used inan in-order architecture. While the illustrated embodiment of theprocessor also includes separate instruction and data cache units3334/3374 and a shared L2 cache unit 3376, alternative embodiments mayhave a single internal cache for both instructions and data, such as,for example, a Level 1 (L1) internal cache, or multiple levels ofinternal cache. In some embodiments, the system may include acombination of an internal cache and an external cache that is externalto the core and/or the processor. Alternatively, all of the cache may beexternal to the core and/or the processor.

Specific Exemplary In-Order Core Architecture

FIGS. 34A-B illustrate a block diagram of a more specific exemplaryin-order core architecture, which core would be one of several logicblocks (including other cores of the same type and/or different types)in a chip. The logic blocks communicate through a high-bandwidthinterconnect network (e.g., a ring network) with some fixed functionlogic, memory I/O interfaces, and other necessary I/O logic, dependingon the application.

FIG. 34A is a block diagram of a single processor core, along with itsconnection to the on-die interconnect network 3402 and with its localsubset of the Level 2 (L2) cache 3404, according to embodiments of theinvention. In one embodiment, an instruction decoder 3400 supports thex86 instruction set with a packed data instruction set extension. An L1cache 3406 allows low-latency accesses to cache memory into the scalarand vector units. While in one embodiment (to simplify the design), ascalar unit 3408 and a vector unit 3410 use separate register sets(respectively, scalar registers 3412 and vector registers 3414) and datatransferred between them is written to memory and then read back in froma level 1 (L1) cache 3406, alternative embodiments of the invention mayuse a different approach (e.g., use a single register set or include acommunication path that allow data to be transferred between the tworegister files without being written and read back).

The local subset of the L2 cache 3404 is part of a global L2 cache thatis divided into separate local subsets, one per processor core. Eachprocessor core has a direct access path to its own local subset of theL2 cache 3404. Data read by a processor core is stored in its L2 cachesubset 3404 and can be accessed quickly, in parallel with otherprocessor cores accessing their own local L2 cache subsets. Data writtenby a processor core is stored in its own L2 cache subset 3404 and isflushed from other subsets, if necessary. The ring network ensurescoherency for shared data. The ring network is bi-directional to allowagents such as processor cores, L2 caches and other logic blocks tocommunicate with each other within the chip. Each ring data-path is1012-bits wide per direction.

FIG. 34B is an expanded view of part of the processor core in FIG. 34Aaccording to embodiments of the invention. FIG. 34B includes an L1 datacache 3406A part of the L1 cache 3404, as well as more detail regardingthe vector unit 3410 and the vector registers 3414. Specifically, thevector unit 3410 is a 16-wide vector processing unit (VPU) (see the16-wide ALU 3428), which executes one or more of integer,single-precision float, and double-precision float instructions. The VPUsupports swizzling the register inputs with swizzle unit 3420, numericconversion with numeric convert units 3422A-B, and replication withreplication unit 3424 on the memory input. Write mask registers 3426allow predicating resulting vector writes.

FIG. 35 is a block diagram of a processor 3500 that may have more thanone core, may have an integrated memory controller, and may haveintegrated graphics according to embodiments of the invention. The solidlined boxes in FIG. 35 illustrate a processor 3500 with a single core3502A, a system agent 3510, a set of one or more bus controller units3516, while the optional addition of the dashed lined boxes illustratesan alternative processor 3500 with multiple cores 3502A-N, a set of oneor more integrated memory controller unit(s) 3514 in the system agentunit 3510, and special purpose logic 3508.

Thus, different implementations of the processor 3500 may include: 1) aCPU with the special purpose logic 3508 being integrated graphics and/orscientific (throughput) logic (which may include one or more cores), andthe cores 3502A-N being one or more general purpose cores (e.g., generalpurpose in-order cores, general purpose out-of-order cores, acombination of the two); 2) a coprocessor with the cores 3502A-N being alarge number of special purpose cores intended primarily for graphicsand/or scientific (throughput); and 3) a coprocessor with the cores3502A-N being a large number of general purpose in-order cores. Thus,the processor 3500 may be a general-purpose processor, coprocessor orspecial-purpose processor, such as, for example, a network orcommunication processor, compression engine, graphics processor, GPGPU(general purpose graphics processing unit), a high-throughput manyintegrated core (MIC) coprocessor (including 30 or more cores), embeddedprocessor, or the like. The processor may be implemented on one or morechips. The processor 3500 may be a part of and/or may be implemented onone or more substrates using any of a number of process technologies,such as, for example, BiCMOS, CMOS, or NMOS.

The memory hierarchy includes one or more levels of cache within thecores, a set or one or more shared cache units 3506, and external memory(not shown) coupled to the set of integrated memory controller units3514. The set of shared cache units 3506 may include one or moremid-level caches, such as level 2 (L2), level 3 (L3), level 4 (L4), orother levels of cache, a last level cache (LLC), and/or combinationsthereof. While in one embodiment a ring based interconnect unit 3512interconnects the special purpose logic 3508 (e.g., integrated graphicslogic), the set of shared cache units 3506, and the system agent unit3510/integrated memory controller unit(s) 3514, alternative embodimentsmay use any number of well-known techniques for interconnecting suchunits. In one embodiment, coherency is maintained between one or morecache units 3506 and cores 3502-A-N.

In some embodiments, one or more of the cores 3502A-N are capable ofmultithreading. The system agent 3510 includes those componentscoordinating and operating cores 3502A-N. The system agent unit 3510 mayinclude for example a power control unit (PCU) and a display unit. ThePCU may be or include logic and components needed for regulating thepower state of the cores 3502A-N and the integrated graphics logic 3508.The display unit is for driving one or more externally connecteddisplays.

The cores 3502A-N may be homogenous or heterogeneous in terms ofarchitecture instruction set; that is, two or more of the cores 3502A-Nmay be capable of execution the same instruction set, while others maybe capable of executing only a subset of that instruction set or adifferent instruction set.

Exemplary Computer Architectures

FIGS. 36-39 are block diagrams of exemplary computer architectures.Other system designs and configurations known in the arts for laptops,desktops, handheld PCs, personal digital assistants, engineeringworkstations, servers, network devices, network hubs, switches, embeddedprocessors, digital signal processors (DSPs), graphics devices, videogame devices, set-top boxes, micro controllers, cell phones, portablemedia players, hand held devices, and various other electronic devices,are also suitable. In general, a huge variety of systems or electronicdevices capable of incorporating a processor and/or other executionlogic as disclosed herein are generally suitable.

Referring now to FIG. 36, shown is a block diagram of a system 3600 inaccordance with one embodiment of the present invention. The system 3600may include one or more processors 3610, 3615, which are coupled to acontroller hub 3620. In one embodiment the controller hub 3620 includesa graphics memory controller hub (GMCH) 3690 and an Input/Output Hub(IOH) 3650 (which may be on separate chips); the GMCH 3690 includesmemory and graphics controllers to which are coupled memory 3640 and acoprocessor 3645; the IOH 3650 couples input/output (I/O) devices 3660to the GMCH 3690. Alternatively, one or both of the memory and graphicscontrollers are integrated within the processor (as described herein),the memory 3640 and the coprocessor 3645 are coupled directly to theprocessor 3610, and the controller hub 3620 in a single chip with theIOH 3650.

The optional nature of additional processors 3615 is denoted in FIG. 36with broken lines. Each processor 3610, 3615 may include one or more ofthe processing cores described herein and may be some version of theprocessor 3500.

The memory 3640 may be, for example, dynamic random access memory(DRAM), phase change memory (PCM), or a combination of the two. For atleast one embodiment, the controller hub 3620 communicates with theprocessor(s) 3610, 3615 via a multi-drop bus, such as a frontside bus(FSB), point-to-point interface such as QuickPath Interconnect (QPI), orsimilar connection 3695.

In one embodiment, the coprocessor 3645 is a special-purpose processor,such as, for example, a high-throughput MIC processor, a network orcommunication processor, compression engine, graphics processor, GPGPU,embedded processor, or the like. In one embodiment, controller hub 3620may include an integrated graphics accelerator.

There can be a variety of differences between the physical resources3610, 3615 in terms of a spectrum of metrics of merit includingarchitectural, microarchitectural, thermal, power consumptioncharacteristics, and the like.

In one embodiment, the processor 3610 executes instructions that controldata processing operations of a general type. Embedded within theinstructions may be coprocessor instructions. The processor 3610recognizes these coprocessor instructions as being of a type that shouldbe executed by the attached coprocessor 3645. Accordingly, the processor3610 issues these coprocessor instructions (or control signalsrepresenting coprocessor instructions) on a coprocessor bus or otherinterconnect, to coprocessor 3645. Coprocessor(s) 3645 accept andexecute the received coprocessor instructions.

Referring now to FIG. 37, shown is a block diagram of a first morespecific exemplary system 3700 in accordance with an embodiment of thepresent invention. As shown in FIG. 37, multiprocessor system 3700 is apoint-to-point interconnect system, and includes a first processor 3770and a second processor 3780 coupled via a point-to-point interconnect3750.

Each of processors 3770 and 3780 may be some version of the processor3500. In one embodiment of the invention, processors 3770 and 3780 arerespectively processors 3610 and 3615, while coprocessor 3738 iscoprocessor 3645. In another embodiment, processors 3770 and 3780 arerespectively processor 3610 coprocessor 3645.

Processors 3770 and 3780 are shown including integrated memorycontroller (IMC) units 3772 and 3782, respectively. Processor 3770 alsoincludes as part of its bus controller units point-to-point (P-P)interfaces 3776 and 3778; similarly, second processor 3780 includes P-Pinterfaces 3786 and 3788. Processors 3770, 3780 may exchange informationvia a point-to-point (P-P) interface 3750 using P-P interface circuits3778, 3788. As shown in FIG. 37, IMCs 3772 and 3782 couple theprocessors to respective memories, namely a memory 3732 and a memory3734, which may be portions of main memory locally attached to therespective processors.

Processors 3770, 3780 may each exchange information with a chipset 3790via individual P-P interfaces 3752, 3754 using point to point interfacecircuits 3776, 3794, 3786, 3798. Chipset 3790 may optionally exchangeinformation with the coprocessor 3738 via a high-performance interface3792. In one embodiment, the coprocessor 3738 is a special-purposeprocessor, such as, for example, a high-throughput MIC processor, anetwork or communication processor, compression engine, graphicsprocessor, GPGPU, embedded processor, or the like.

A shared cache (not shown) may be included in either processor oroutside of both processors, yet connected with the processors via P-Pinterconnect, such that either or both processors' local cacheinformation may be stored in the shared cache if a processor is placedinto a low power mode.

Chipset 3790 may be coupled to a first bus 3716 via an interface 3796.In one embodiment, first bus 3716 may be a Peripheral ComponentInterconnect (PCI) bus, or a bus such as a PCI Express bus or anotherthird generation I/O interconnect bus, although the scope of the presentinvention is not so limited.

As shown in FIG. 37, various I/O devices 3714 may be coupled to firstbus 3716, along with a bus bridge 3718 which couples first bus 3716 to asecond bus 3720. In one embodiment, one or more additional processor(s)3715, such as coprocessors, high-throughput MIC processors, GPGPU's,accelerators (such as, e.g., graphics accelerators or digital signalprocessing (DSP) units), field programmable gate arrays, or any otherprocessor, are coupled to first bus 3716. In one embodiment, second bus3720 may be a low pin count (LPC) bus. Various devices may be coupled toa second bus 3720 including, for example, a keyboard and/or mouse 3722,communication devices 3727 and a storage unit 3728 such as a disk driveor other mass storage device which may include instructions/code anddata 3730, in one embodiment. Further, an audio I/O 3724 may be coupledto the second bus 3720. Note that other architectures are possible. Forexample, instead of the point-to-point architecture of FIG. 37, a systemmay implement a multi-drop bus or other such architecture.

Referring now to FIG. 38, shown is a block diagram of a second morespecific exemplary system 3800 in accordance with an embodiment of thepresent invention. Like elements in FIGS. 37 and 38 bear like referencenumerals, and certain aspects of FIG. 37 have been omitted from FIG. 38in order to avoid obscuring other aspects of FIG. 38.

FIG. 38 illustrates that the processors 3770, 3780 may includeintegrated memory and I/O control logic (“CL”) 3772 and 3782,respectively. Thus, the CL 3772, 3782 include integrated memorycontroller units and include I/O control logic. FIG. 38 illustrates thatnot only are the memories 3732, 3734 coupled to the CL 3772, 3782, butalso that I/O devices 3814 are also coupled to the control logic 3772,3782. Legacy I/O devices 3815 are coupled to the chipset 3790.

Referring now to FIG. 39, shown is a block diagram of a SoC 3900 inaccordance with an embodiment of the present invention. Similar elementsin FIG. 35 bear like reference numerals. Also, dashed lined boxes areoptional features on more advanced SoCs. In FIG. 39, an interconnectunit(s) 3902 is coupled to: an application processor 3910 which includesa set of one or more cores 3502A-N, which include cache units 3504A-N,and shared cache unit(s) 3506; a system agent unit 3510; a buscontroller unit(s) 3516; an integrated memory controller unit(s) 3514; aset or one or more coprocessors 3920 which may include integratedgraphics logic, an image processor, an audio processor, and a videoprocessor; an static random access memory (SRAM) unit 3930; a directmemory access (DMA) unit 3932; and a display unit 3940 for coupling toone or more external displays. In one embodiment, the coprocessor(s)3920 include a special-purpose processor, such as, for example, anetwork or communication processor, compression engine, GPGPU, ahigh-throughput MIC processor, embedded processor, or the like.

Embodiments of the mechanisms disclosed herein may be implemented inhardware, software, firmware, or a combination of such implementationapproaches. Embodiments of the invention may be implemented as computerprograms or program code executing on programmable systems comprising atleast one processor, a storage system (including volatile andnon-volatile memory and/or storage elements), at least one input device,and at least one output device.

Program code, such as code 3730 illustrated in FIG. 37, may be appliedto input instructions to perform the functions described herein andgenerate output information. The output information may be applied toone or more output devices, in known fashion. For purposes of thisapplication, a processing system includes any system that has aprocessor, such as, for example; a digital signal processor (DSP), amicrocontroller, an application specific integrated circuit (ASIC), or amicroprocessor.

The program code may be implemented in a high level procedural or objectoriented programming language to communicate with a processing system.The program code may also be implemented in assembly or machinelanguage, if desired. In fact, the mechanisms described herein are notlimited in scope to any particular programming language. In any case,the language may be a compiled or interpreted language.

One or more aspects of at least one embodiment may be implemented byrepresentative instructions stored on a machine-readable medium whichrepresents various logic within the processor, which when read by amachine causes the machine to fabricate logic to perform the techniquesdescribed herein. Such representations, known as “IP cores” may bestored on a tangible, machine readable medium and supplied to variouscustomers or manufacturing facilities to load into the fabricationmachines that actually make the logic or processor.

Such machine-readable storage media may include, without limitation,non-transitory, tangible arrangements of articles manufactured or formedby a machine or device, including storage media such as hard disks, anyother type of disk including floppy disks, optical disks, compact diskread-only memories (CD-ROMs), compact disk rewritable's (CD-RWs), andmagneto-optical disks, semiconductor devices such as read-only memories(ROMs), random access memories (RAMs) such as dynamic random accessmemories (DRAMs), static random access memories (SRAMs), erasableprogrammable read-only memories (EPROMs), flash memories, electricallyerasable programmable read-only memories (EEPROMs), phase change memory(PCM), magnetic or optical cards, or any other type of media suitablefor storing electronic instructions.

Accordingly, embodiments of the invention also include non-transitory,tangible machine-readable media containing instructions or containingdesign data, such as Hardware Description Language (HDL), which definesstructures, circuits, apparatuses, processors and/or system featuresdescribed herein. Such embodiments may also be referred to as programproducts.

Emulation (Including Binary Translation, Code Morphing, Etc.)

In some cases, an instruction converter may be used to convert aninstruction from a source instruction set to a target instruction set.For example, the instruction converter may translate (e.g., using staticbinary translation, dynamic binary translation including dynamiccompilation), morph, emulate, or otherwise convert an instruction to oneor more other instructions to be processed by the core. The instructionconverter may be implemented in software, hardware, firmware, or acombination thereof. The instruction converter may be on processor, offprocessor, or part on and part off processor.

FIG. 40 is a block diagram contrasting the use of a software instructionconverter to convert binary instructions in a source instruction set tobinary instructions in a target instruction set according to embodimentsof the invention. In the illustrated embodiment, the instructionconverter is a software instruction converter, although alternativelythe instruction converter may be implemented in software, firmware,hardware, or various combinations thereof. FIG. 40 shows a program in ahigh level language 4002 may be compiled using an x86 compiler 4004 togenerate x86 binary code 4006 that may be natively executed by aprocessor with at least one x86 instruction set core 4016. The processorwith at least one x86 instruction set core 4016 represents any processorthat can perform substantially the same functions as an Intel processorwith at least one x86 instruction set core by compatibly executing orotherwise processing (1) a substantial portion of the instruction set ofthe Intel x86 instruction set core or (2) object code versions ofapplications or other software targeted to run on an Intel processorwith at least one x86 instruction set core, in order to achievesubstantially the same result as an Intel processor with at least onex86 instruction set core. The x86 compiler 4004 represents a compilerthat is operable to generate x86 binary code 4006 (e.g., object code)that can, with or without additional linkage processing, be executed onthe processor with at least one x86 instruction set core 4016.Similarly, FIG. 40 shows the program in the high level language 4002 maybe compiled using an alternative instruction set compiler 4008 togenerate alternative instruction set binary code 4010 that may benatively executed by a processor without at least one x86 instructionset core 4014 (e.g., a processor with cores that execute the MIPSinstruction set of MIPS Technologies of Sunnyvale, Calif. and/or thatexecute the ARM instruction set of ARM Holdings of Sunnyvale, Calif.).The instruction converter 4012 is used to convert the x86 binary code4006 into code that may be natively executed by the processor without anx86 instruction set core 4014. This converted code is not likely to bethe same as the alternative instruction set binary code 4010 because aninstruction converter capable of this is difficult to make; however, theconverted code will accomplish the general operation and be made up ofinstructions from the alternative instruction set. Thus, the instructionconverter 4012 represents software, firmware, hardware, or a combinationthereof that, through emulation, simulation or any other process, allowsa processor or other electronic device that does not have an x86instruction set processor or core to execute the x86 binary code 4006.

Though the flow diagrams in the figures show a particular order ofoperations performed by certain embodiments, it should be understoodthat such order is exemplary. Thus, alternative embodiments may performthe operations in a different order, combine certain operations, overlapcertain operations, etc.

Additionally, although the invention has been described in terms ofseveral embodiments, those skilled in the art will recognize that theinvention is not limited to the embodiments described, can be practicedwith modification and alteration within the spirit and scope of theappended claims. The description is thus to be regarded as illustrativeinstead of limiting.

What is claimed is:
 1. A method in a first hardware processor (HP)comprising: determining, by the first HP, that a task as been offloadedfrom a second HP to the first HP, the first HP comprising a memory unitthat is banked into a plurality of banks and a plurality of processingelements (PEs), each PE being directly coupled via one or moreneighbor-to-neighbor links with one or more neighboring PEs so that eachPE can receive a value from a neighboring PE, provide a value to aneighboring PE, or both receive a value from one neighboring PE and alsoprovide a value to another neighboring PE; and executing the task by thefirst HP, including causing each of the plurality of PEs to execute oneor more iterations of a same subtask of the task, wherein for each ofthe iterations ones of the plurality of PEs are to access one or moredata values obtained from the memory unit and both determine a valuebased upon a first value received from a first neighboring PE and atleast one of the one or more data values and provide the determinedvalue to a second neighboring PE for its use in performing the iterationof the subtask, wherein the executing of the task includes multiple onesof the plurality of PEs sending data over a reduction link to areduction network of the first HP that performs aggregate operationsusing the data and results in the first HP determining one or moreoutput values, wherein the executing of the task includes: executing, bya first PE of the plurality of PEs of the first HP, a first iteration ofthe subtask, wherein the executing includes accessing a first set of oneor more data values from the memory unit, generating a first value basedupon the first set of data values, and sending the first value to asecond PE of the plurality of PEs via a first neighbor-to-neighbor link;executing, by the second PE of the plurality of PEs, a second iterationof the subtask, comprising accessing a second set of one or more datavalues from the memory unit, generating a second value based upon thesecond set of data values and also the first value, and sending thesecond value to a third PE of the plurality of PEs via a secondneighbor-to-neighbor link; and determining, by the first HP, the one ormore output values to be a result for the task based at least in partupon the first value and the second value.
 2. The method of claim 1,further comprising providing, by the first HP, the one or more outputvalues to the second HP.
 3. The method of claim 1, wherein the pluralityof banks includes at least thirty-two banks.
 4. The method of claim 1,wherein there are at most twenty cycles of latency for a memory accessby one of the plurality of PEs to one of the plurality of banks of thememory unit.
 5. The method of claim 1, wherein the one or more datavalues comprise a first vector of data values and a second vector ofdata values, wherein the determined value is based upon at least onedata value of the first vector of data values and at least one value ofthe second vector of data values.
 6. The method of claim 1, wherein eachof the plurality of PEs is capable of performing integer operations,floating point operations, and control operations.
 7. The method ofclaim 1, wherein the executing the task by the first HP comprisesexecuting one or more instructions generated by a compiler, wherein theone or more instructions include at least one fetchLeft instructioncausing a PE to obtain a value from a neighboring PE via aneighbor-to-neighbor link and at least one sendRight instruction causinga PE to send a value to a neighboring PE via a neighbor-to-neighborlink.
 8. A hardware processor (HP) comprising: a memory unit that isbanked into a plurality of banks; a plurality of processing elements(PEs), wherein each of the plurality of PEs is directly coupled via oneor more neighbor-to-neighbor links with one or more neighboring PEs ofthe plurality of PEs so that each PE can receive a value from aneighboring PE, provide a value to a neighboring PE, or both receive avalue from one neighboring PE and also provide a value to anotherneighboring PE, and wherein each of the plurality of PEs is coupled viaa reduction link to a reduction network of the hardware processor thatis to perform aggregate operations using data provided over thereduction link by multiple ones of the plurality of PEs; and a controlengine that is coupled with the plurality of PEs that is to cause theplurality of PEs to collectively perform a task to generate one or moreoutput values by each performing one or more iterations of a samesubtask of the task, wherein each of the one or more iterations includesthe PE receiving a value from a neighboring PE, providing a value to aneighboring PE, or both receiving a value from one neighboring PE andalso providing a value to another neighboring PE, wherein the controlengine, to perform the task, causes: a first PE of the plurality of PEsof the HP to execute a first iteration of the subtask, which is toinclude an access of a first set of one or more data values from thememory unit, a generation of a first value based upon the first set ofdata values, and a send of the first value to a second PE of theplurality of PEs via a first neighbor-to-neighbor link; and the secondPE of the plurality of PEs to execute a second iteration of the subtask,which is to include an access of a second set of one or more data valuesfrom the memory unit, a generation of a second value based upon thesecond set of data values and also the first value, and a send of thesecond value to a third PE of the plurality of PEs via a secondneighbor-to-neighbor link, wherein the HP is to determine the one ormore output values to be a result for the task based at least in partupon the first value and the second value.
 9. The hardware processor ofclaim 8, wherein the plurality of banks includes at least eight banks.10. The hardware processor of claim 9, wherein the plurality of banksincludes at least thirty-two banks.
 11. The hardware processor of claim8, wherein there are at most twenty cycles of latency for a memoryaccess by one of the plurality of PEs to one of the plurality of banksof the memory unit.
 12. The hardware processor of claim 8, wherein eachof the plurality of PEs is capable of performing integer operations,floating point operations, and control operations.
 13. The hardwareprocessor of claim 8, wherein the hardware processor further includes aninterface that is to enable the hardware processor to be coupled via oneor more buses with another hardware processor, wherein the anotherhardware processor is to offload the task to the hardware processor. 14.A system comprising: a first hardware processor (HP) that is to offloada task to a second HP; and the second HP, comprising: a memory unit thatis banked into a plurality of banks; a plurality of processing elements(PEs), wherein each of the plurality of PEs is directly coupled via oneor more neighbor-to-neighbor links with one or more neighboring PEs ofthe plurality of PEs so that each PE can receive a value from aneighboring PE, provide a value to a neighboring PE, or both receive avalue from one neighboring PE and also provide a value to anotherneighboring PE, and wherein each of the plurality of PEs is coupled viaa reduction link to a reduction network of the second hardware processorthat is to perform aggregate operations using data provided over thereduction link by multiple ones of the plurality of PEs; and a controlengine that is coupled with the plurality of PEs and that is to causethe plurality of PEs to collectively perform a task to generate one ormore output values by each performing one or more iterations of a samesubtask of the task, wherein each of the one or more iterations includesthe PE receiving a value from a neighboring PE, providing a value to aneighboring PE, or both receiving a value from one neighboring PE andalso providing a value to another neighboring PE, wherein the controlengine, to perform the task, causes: a first PE of the plurality of PEsof the second HP to execute a first iteration of the subtask, which isto include an access of a first set of one or more data values from thememory unit, a generation of a first value based upon the first set ofdata values, and a send of the first value to a second PE of theplurality of PEs via a first neighbor-to-neighbor link; and the secondPE of the plurality of PEs to execute a second iteration of the subtask,which is to include an access of a second set of one or more data valuesfrom the memory unit, a generation of a second value based upon thesecond set of data values and also the first value, and a send of thesecond value to a third PE of the plurality of PEs via a secondneighbor-to-neighbor link, wherein the second HP is to determine the oneor more output values to be a result for the task based at least in partupon the first value and the second value.
 15. The system of claim 14,wherein the plurality of banks includes at least eight banks.
 16. Thesystem of claim 15, wherein the plurality of banks includes at leastthirty-two banks.
 17. The system of claim 14, wherein there are at mosttwenty cycles of latency for a memory access by one of the plurality ofPEs to one of the plurality of banks of the memory unit.
 18. The systemof claim 14, wherein each of the plurality of PEs is capable ofperforming integer operations, floating point operations, and controloperations.
 19. The system of claim 14, wherein the second HP furtherincludes an interface that couples the second HP via one or more buseswith the first HP.